I'm running on OS X 11.2.3 and ruby 3.0.1, rails 6.1.3.2 under rvm and nodejs15 (but I've tried this with ruby 2.7.2 and 2.5 as well and I've tried with builtin ruby and macports one including ripping out every non-system ruby file and reinstalling both ruby and node) and every time I either use rails new or try to run the command rails webpacker:install I get the following error.
/Users/TruePath/Documents/Projects/math-site/bin/rails:in `require': cannot load such file -- ubygems (LoadError)
I've tried creating the project without sprockets, without spring and I've checked yarn is the right version. I've included the messages generated when I run the command with verbose below.
Please help I've now spent like 2 whole days trying to track this down without luck! Note that the unstable version of nodejs warning isn't it since I wasted a bunch of time tearing out any hint of nodejs and reinstalling a stable version without luck.
ruby --verbose bin/rails webpacker:install
/usr/local/rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49: warning: method redefined; discarding old require_relative
/usr/local/rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:57: warning: method redefined; discarding old load
/usr/local/rvm/gems/ruby-3.0.1/gems/sassc-rails-2.1.2/lib/sassc/rails/functions.rb:7: warning: method redefined; discarding old asset_data_url
/usr/local/rvm/gems/ruby-3.0.1/gems/sprockets-4.0.2/lib/sprockets/sass_processor.rb:274: warning: previous definition of asset_data_url was here
/usr/local/rvm/gems/ruby-3.0.1/gems/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb:7: warning: method redefined; discarding old initialize
/usr/local/rvm/gems/ruby-3.0.1/gems/sprockets-4.0.2/lib/sprockets/sass_compressor.rb:39: warning: previous definition of initialize was here
/usr/local/rvm/gems/ruby-3.0.1/gems/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb:17: warning: method redefined; discarding old call
/usr/local/rvm/gems/ruby-3.0.1/gems/sprockets-4.0.2/lib/sprockets/sass_compressor.rb:49: warning: previous definition of call was here
/usr/local/rvm/gems/ruby-3.0.1/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:23: warning: method redefined; discarding old require
/usr/local/rvm/gems/ruby-3.0.1/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:27: warning: previous definition of require was here
Warning: you are using an unstable release of Node.js (v15.14.0). If you encounter issues with Node.js, consider switching to an Active LTS release. More info: https://docs.npmjs.com/try-the-latest-stable-version-of-node
/Users/TruePath/Documents/Projects/math-site/bin/rails:in `require': cannot load such file -- ubygems (LoadError)
It appears this error was caused by having my bashrc set RUBYOPT=rubygems which seemed to cause weird mixing of code issues. Dunno how or why but that seemed to be the issue so maybe this will help someone else avoid lots of pain and suffering trying to chase it down themselves.