Webpacker Install gives error: cannot load such file — ubygems

Webpacker Install gives error: cannot load such file — ubygems

我运行宁在 OS X 11.2.3 和 ruby 3.0.1,rails 6.1.3.2 下 rvm 和 nodejs15(但我'我也用 ruby 2.7.2 和 2.5 试过了,我试过内置 ruby 和 macports 一个,包括删除每个非系统 ruby 文件并重新安装两个 ruby 和节点),每次我使用 rails new 或尝试 运行 命令 rails webpacker:install 我都会收到以下错误。

/Users/TruePath/Documents/Projects/math-site/bin/rails:in `require': cannot load such file -- ubygems (LoadError)

我尝试创建没有链轮的项目,没有 spring 并且我检查了 yarn 是正确的版本。我在下面包含了 运行 详细命令时生成的消息。

请帮助我现在已经花了整整 2 天时间试图找到它,但没有成功!请注意,nodejs 的不稳定版本警告不是因为我浪费了很多时间撕掉 nodejs 的任何提示并重新安装稳定版本而没有运气。

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)

看来这个错误是由于我的 bashrc 设置了 RUBYOPT=rubygems 而引起的,这似乎导致了代码问题的奇怪混合。不知道如何或为什么,但这似乎是问题所在,所以也许这会帮助其他人避免很多痛苦和痛苦,试图自己追逐它。