Edit 1: Another person reported similar issue with asdf.
Edit 2: Another reported similar issue.
Edit 3: I uninstalled rvm
, installed rvm
, installed ruby
and rails
, and attempted some activities.
Edit 4: Another person mentioned that it's caused by the line I put into .zshrc
(or .bash_profile/.bashrc
):
RUBYOPT: "-W:no-deprecated -W:no-experimental"
.
Problem: I have two projects, one using ruby-2.7.0
, the other using ruby-2.6.5
.
Every time I installed over two versions of ruby, only one version ends up working (2.7.0). The bundle
as well as gem
commands on the other will no longer work but give a Traceback....(RuntimeError)
.
Most Recent Attempt and Console Outputs: Console output flow is roughly:
rvm
rvm
ruby-2.7.0
ruby-2.6.5
ruby-2.7.0
, install rails
ruby-2.6.5
, install rails
export PATH="$PATH:$HOME/.rvm/bin"
to ~/.zshrcecho "export RUBYOPT='-W:no-deprecated -W:no-experimental'" >> ~/.zshrc
; source ~/.zshrc
ruby-2.6.5
does not work; ruby-2.7.0
still works# UNINSTALL RVM
(base) ? ~ rvm -v
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
(base) ? ~ which ruby
/Users/nahua/.rvm/rubies/ruby-2.6.5/bin/ruby
(base) ? ~ which rails
/usr/bin/rails
(base) ? ~ rbenv
zsh: command not found: rbenv
(base) ? ~
(base) ? ~ rvm implode
Are you SURE you wish for rvm to implode?
This will recursively remove /Users/nahua/.rvm and other rvm traces?
(anything other than 'yes' will cancel) > yes
Removing rvm-shipped binaries (rvm-prompt, rvm, rvm-sudo rvm-shell and rvm-auto-ruby)
Removing rvm wrappers in /Users/nahua/.rvm/bin
Hai! Removing /Users/nahua/.rvm
/Users/nahua/.rvm has been removed.
Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they exist still.
Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.
Also make sure to remove `rvm` group if this was a system installation.
Finally it might help to relogin / restart if you want to have fresh environment (like for installing RVM again).
(base) ? ~ gem uninstall rvm
Traceback (most recent call last):
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby: invalid option -: (-h will show valid options) (RuntimeError)
(base) ? ~ which ruby
/usr/bin/ruby
(base) ? ~ rvm -v
cat: /Users/nahua/.rvm/VERSION: No such file or directory
__rvm_initialize:source:4: no such file or directory: /Users/nahua/.rvm/scripts/base
cat: /Users/nahua/.rvm/VERSION: No such file or directory
rvm () by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
# COMMENT OFF ALL RVM LINES IN THE FOLLOWING FILES
(base) ? ~ subl .bashrc
(base) ? ~ subl .profile
(base) ? ~ subl .zshrc
(base) ? ~ subl .bash_profile
(base) ? ~ subl .zlogin
(base) ? ~ subl /etc/profile # nothing there
(base) ? ~ sudo vim /etc/profile # nothing there
Password:
(base) ? ~ exit
# RESTART TERMINAL
(base) ? ~ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
(base) ? ~ which ruby
/usr/bin/ruby
(base) ? ~ which gem
/usr/bin/gem
(base) ? ~ which bundle
/usr/bin/bundle
(base) ? ~ clear
(base) ? ~ rvm list
zsh: command not found: rvm
(base) ? ~ rbenv versions
zsh: command not found: rbenv
# INSTALL RVM
(base) ? ~ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Warning: Failed to set locale category LC_NUMERIC to en_DE.
Warning: Failed to set locale category LC_TIME to en_DE.
Warning: Failed to set locale category LC_COLLATE to en_DE.
Warning: Failed to set locale category LC_MONETARY to en_DE.
Warning: Failed to set locale category LC_MESSAGES to en_DE.
gpg: key 105BD0E739499BDB: "Piotr Kuczynski <piotr.kuczynski@gmail.com>" not changed
gpg: key 3804BB82D39DC0E3: "Michal Papis (RVM signing) <mpapis@gmail.com>" not changed
gpg: Total number processed: 2
gpg: unchanged: 2
(base) ? ~ \curl -sSL https://get.rvm.io | bash -s stable --ruby
Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc
Warning: Failed to set locale category LC_NUMERIC to en_DE.
Warning: Failed to set locale category LC_TIME to en_DE.
Warning: Failed to set locale category LC_COLLATE to en_DE.
Warning: Failed to set locale category LC_MONETARY to en_DE.
Warning: Failed to set locale category LC_MESSAGES to en_DE.
gpg: Signature made Wed Jul 10 10:31:02 2019 CEST
gpg: using RSA key 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
GPG verified '/Users/nahua/.rvm/archives/rvm-1.29.9.tgz'
Installing RVM to /Users/nahua/.rvm/
RVM PATH line found in /Users/nahua/.mkshrc /Users/nahua/.profile /Users/nahua/.bashrc /Users/nahua/.zshrc.
RVM sourcing line found in /Users/nahua/.profile /Users/nahua/.bash_profile /Users/nahua/.zlogin.
Installation of RVM in /Users/nahua/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/nahua/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Thanks for installing RVM
Please consider donating to our open collective to help us maintain RVM.
Donate: https://opencollective.com/rvm/donate
Ruby enVironment Manager 1.29.9 (latest) (c) 2009-2017 Michal Papis, Piotr Kuczynski, Wayne E. Seguin
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.6.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/nahua/.rvm/rubies/ruby-2.6.3, this may take a while depending on your cpu(s)...
ruby-2.6.3 - #downloading ruby-2.6.3, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.8M 100 13.8M 0 0 4529k 0 0:00:03 0:00:03 --:--:-- 4529k
ruby-2.6.3 - #extracting ruby-2.6.3 to /Users/nahua/.rvm/src/ruby-2.6.3.....
ruby-2.6.3 - #configuring.......................................................................
ruby-2.6.3 - #post-configuration.
ruby-2.6.3 - #compiling.....................................................................
ruby-2.6.3 - #installing...........
ruby-2.6.3 - #making binaries executable..
ruby-2.6.3 - #downloading rubygems-3.0.6
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 866k 100 866k 0 0 3437k 0 --:--:-- --:--:-- --:--:-- 3437k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.6.3 - #extracting rubygems-3.0.6.....
ruby-2.6.3 - #removing old rubygems........
$LANG was empty, setting up LANG=en_US.US-ASCII, if it fails again try setting LANG to something sane and try again.
ruby-2.6.3 - #installing rubygems-3.0.6...............................................
ruby-2.6.3 - #gemset created /Users/nahua/.rvm/gems/ruby-2.6.3@global
ruby-2.6.3 - #importing gemset /Users/nahua/.rvm/gemsets/global.gems......................................................-
ruby-2.6.3 - #generating global wrappers.......
ruby-2.6.3 - #gemset created /Users/nahua/.rvm/gems/ruby-2.6.3
ruby-2.6.3 - #importing gemsetfile /Users/nahua/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.6.3 - #generating default wrappers.......
ruby-2.6.3 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.6.3 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
Creating alias default for ruby-2.6.3....
* To start using RVM you need to run `source /Users/nahua/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
(base) ? ~ source /Users/nahua/.rvm/scripts/rvm
source /Users/nahua/.rvm/scripts/rvm
(base) ? ~ rvm
Ruby enVironment Manager 1.29.9 (latest) (c) 2009-2017 Michal Papis, Piotr Kuczynski, Wayne E. Seguin
For additional documentation please visit https://rvm.io
(base) ? ~ echo $PATH
/Users/nahua/.rvm/gems/ruby-2.6.3/bin:/Users/nahua/.rvm/gems/ruby-2.6.3@global/bin:/Users/nahua/.rvm/rubies/ruby-2.6.3/bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/Users/nahua/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/nahua/.rvm/bin
(base) ? ~ rvm -v
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
(base) ? ~ rvm list
=* ruby-2.6.3 [ x86_64 ]
# => - current
# =* - current && default
# * - default
(base) ? ~ rvm install 2.7.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.7.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/nahua/.rvm/rubies/ruby-2.7.0, this may take a while depending on your cpu(s)...
ruby-2.7.0 - #downloading ruby-2.7.0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.0M 100 14.0M 0 0 4616k 0 0:00:03 0:00:03 --:--:-- 4616k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.7.0 - #extracting ruby-2.7.0 to /Users/nahua/.rvm/src/ruby-2.7.0 - please wait
ruby-2.7.0 - #configuring - please wait
ruby-2.7.0 - #post-configuration - please wait
ruby-2.7.0 - #compiling - please wait
ruby-2.7.0 - #installing - please wait
ruby-2.7.0 - #making binaries executable - please wait
Installed rubygems 3.1.2 is newer than 3.0.6 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.0 - #gemset created /Users/nahua/.rvm/gems/ruby-2.7.0@global
ruby-2.7.0 - #importing gemset /Users/nahua/.rvm/gemsets/global.gems - please wait
ruby-2.7.0 - #generating global wrappers - please wait
ruby-2.7.0 - #gemset created /Users/nahua/.rvm/gems/ruby-2.7.0
ruby-2.7.0 - #importing gemsetfile /Users/nahua/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.0 - #generating default wrappers - please wait
ruby-2.7.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.0 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
(base) ? ~ rvm list
* ruby-2.6.3 [ x86_64 ]
=> ruby-2.7.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
(base) ? ~ gem -v
3.1.2
(base) ? ~ bundle -v
Bundler version 2.1.2
(base) ? ~ rvm use 2.6.3
Using /Users/nahua/.rvm/gems/ruby-2.6.3
(base) ? ~ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]
(base) ? ~ gem -v
3.0.6
(base) ? ~ bundle -v
Bundler version 1.17.3
(base) ? ~ rvm use 2.7.0
Using /Users/nahua/.rvm/gems/ruby-2.7.0
(base) ? ~ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
(base) ? ~ gem -v
3.1.2
(base) ? ~ bundle -v
Bundler version 2.1.2
(base) ? ~ rvm install 2.6.5
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.6.5.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/nahua/.rvm/rubies/ruby-2.6.5, this may take a while depending on your cpu(s)...
ruby-2.6.5 - #downloading ruby-2.6.5, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.4M 100 13.4M 0 0 9377k 0 0:00:01 0:00:01 --:--:-- 9370k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.6.5 - #extracting ruby-2.6.5 to /Users/nahua/.rvm/src/ruby-2.6.5 - please wait
ruby-2.6.5 - #configuring - please wait
ruby-2.6.5 - #post-configuration - please wait
ruby-2.6.5 - #compiling - please wait
ruby-2.6.5 - #installing - please wait
ruby-2.6.5 - #making binaries executable - please wait
ruby-2.6.5 - #downloading rubygems-3.0.6
ruby-2.6.5 - #extracting rubygems-3.0.6 - please wait
ruby-2.6.5 - #removing old rubygems - please wait
$LANG was empty, setting up LANG=en_US.US-ASCII, if it fails again try setting LANG to something sane and try again.
ruby-2.6.5 - #installing rubygems-3.0.6 - please wait
ruby-2.6.5 - #gemset created /Users/nahua/.rvm/gems/ruby-2.6.5@global
ruby-2.6.5 - #importing gemset /Users/nahua/.rvm/gemsets/global.gems - please wait
ruby-2.6.5 - #generating global wrappers - please wait
ruby-2.6.5 - #gemset created /Users/nahua/.rvm/gems/ruby-2.6.5
ruby-2.6.5 - #importing gemsetfile /Users/nahua/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.6.5 - #generating default wrappers - please wait
ruby-2.6.5 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.6.5 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
(base) ? ~ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
(base) ? ~ gem -v
3.0.6
(base) ? ~ bundle -v
Bundler version 1.17.3
(base) ? ~ gem install rails
...
IGNORED DUE TO CHARACTER LIMIT ON STACKOVERFLOW
...
Successfully installed concurrent-ruby-1.1.5
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
If you are upgrading your Rails application from an older version of Rails:
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
If you are starting a NEW Rails application, you can ignore this notice.
For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
...
IGNORED DUE TO CHARACTER LIMIT ON STACKOVERFLOW
...
Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, zeitwerk, activesupport, rack, rack-test, mini_portile2, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, builder, erubi, actionview, actionpack, activemodel, activerecord, globalid, activejob, mini_mime, mail, actionmailer, nio4r, websocket-extensions, websocket-driver, actioncable, mimemagic, marcel, activestorage, actionmailbox, actiontext, thor, method_source, railties, sprockets, sprockets-rails, rails after 39 seconds
40 gems installed
(base) ? ~ rails -v
Rails 6.0.2.1
(base) ? ~ rvm use 2.6.5
Using /Users/nahua/.rvm/gems/ruby-2.6.5
(base) ? ~ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
(base) ? ~ gem install rails
...
IGNORED DUE TO CHARACTER LIMIT ON STACKOVERFLOW
...
Successfully installed concurrent-ruby-1.1.5
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
If you are upgrading your Rails application from an older version of Rails:
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
If you are starting a NEW Rails application, you can ignore this notice.
For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
...
IGNORED DUE TO CHARACTER LIMIT ON STACKOVERFLOW
...
Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, zeitwerk, activesupport, rack, rack-test, mini_portile2, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, builder, erubi, actionview, actionpack, activemodel, activerecord, globalid, activejob, mini_mime, mail, actionmailer, nio4r, websocket-extensions, websocket-driver, actioncable, mimemagic, marcel, activestorage, actionmailbox, actiontext, thor, method_source, railties, sprockets, sprockets-rails, rails after 34 seconds
40 gems installed
(base) ? ~ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
(base) ? ~ rvm list
* ruby-2.6.3 [ x86_64 ]
=> ruby-2.6.5 [ x86_64 ]
ruby-2.7.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
(base) ? ~ rvm use 2.7.0
Using /Users/nahua/.rvm/gems/ruby-2.7.0
(base) ? ~ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
(base) ? ~ rvm use 2.6.5
Using /Users/nahua/.rvm/gems/ruby-2.6.5
(base) ? ~ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
(base) ? ~ cd projects/rails/DevcampPortfolio
(base) ? DevcampPortfolio git:(portfolio-feature) ? cat .ruby-version
2.7.0
(base) ? DevcampPortfolio git:(portfolio-feature) ? rvm list
* ruby-2.6.3 [ x86_64 ]
ruby-2.6.5 [ x86_64 ]
=> ruby-2.7.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
(base) ? DevcampPortfolio git:(portfolio-feature) ? rails c
Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4`.
Could not find minitest-5.14.0 in any of the sources
Run `bundle install` to install missing gems.
(base) ? DevcampPortfolio git:(portfolio-feature) ? clear
(base) ? DevcampPortfolio git:(portfolio-feature) ? which bundle
/Users/nahua/.rvm/rubies/ruby-2.7.0/bin/bundle
(base) ? DevcampPortfolio git:(portfolio-feature) ? bundle install
Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4`.
Fetching gem metadata from https://rubygems.org/............
...
### BUNDLE INSTALL...DELETING DUE TO CHARACTER LIMIT ON STACKOVERFLOW
...
Bundle complete! 15 Gemfile dependencies, 67 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
(base) ? DevcampPortfolio git:(portfolio-feature) ? gem install bundler:2.1.4
Fetching bundler-2.1.4.gem
Successfully installed bu
我遇到了完全相同的问题,除了将 rbenv 与 bash 一起使用。
肇事者似乎是 .zsh 文件中的 echo "export RUBYOPT='-W:no-deprecated -W:no-experimental'" 行,我不确定 Ruby 2.6.5 是否理解它。
从您的 .zsh / .bashrc / .profile 中删除 echo "export RUBYOPT='-W:no-deprecated -W:no-experimental'" 并重新启动您的外壳。