I've been trying to upgrade my rails environment on my MacBook and I've messed something up, but I'm not sure what. Is it possible to completely remove RVM, Ruby and Rails and start from scratch? I'm quite confused at how this is all supposed to work.
我一直在试图升级我的MacBook上的rails环境,但我搞砸了,但我不知道是什么。是否有可能完全删除RVM、Ruby和Rails并从头开始?我很困惑这一切是怎么回事。
I've currently got Ruby 1.8.7 and 1.9.2 installed via RVM. I had rails upgraded to 3.0.9 but it refuses to work now, citing some error with rake.
我现在已经通过RVM安装了Ruby 1.8.7和1.9.2。我曾将rails升级到3.0.9,但现在它以rake有一些错误为由拒绝运行。
/Users/Moshe/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in
to_specs': Could not find rails (>= 0) amongst [rake-0.8.7, rake-0.8.7, rubygems-update-1.8.5] (Gem::LoadError) from /Users/Moshe/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in
to_spec' from /Users/Moshe/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1182:ingem' from /Users/Moshe/.rvm/rubies/ruby-1.9.2-p180/bin/rails:18:in
'/用户/ Moshe / .rvm /红宝石/ ruby-1.9.2-p180 / lib / ruby / site_ruby / 1.9.1 / rubygems /依赖。rb:247:在to_spec中:无法找到rails(>= 0),其中[rake-0.8.7, rake-0.8.7, rubygems-update1.8.5] (Gem: LoadError)来自/用户/Moshe/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/ site_ruby/1.9.1/rubygems/ rubygems/依赖。rb:256:into_spec '从/用户/ Moshe / .rvm /红宝石/ ruby-1.9.2-p180 / lib / ruby / site_ruby / 1.9.1 / rubygems。rb:1182:宝石'从/用户/ Moshe / .rvm /红宝石/ ruby-1.9.2-p180 / bin / rails:18:在“
What can I do to fix the situation? I'd like to revert to the version of ruby that came with my Mac.
我能做什么来解决这个问题?我想还原到我的Mac版本的ruby版本。
(Edit: I'm on Snow Leopard 10.6.8)
(编辑:我在看《雪豹》10.6.8)
Edit2:
Edit2:
I've now gotten rvm to run ruby 1.9.2 and rails 3.0.9 However, trying to boot the server using rails server
returns the following:
我现在已经让rvm运行ruby 1.9.2和rails 3.0.9,但是,尝试使用rails服务器引导服务器返回以下内容:
AppMachineMobile:hello Moshe$ rails server
美元AppMachineMobile:你好Moshe rails服务器
=> Booting WEBrick
= >启动WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
=> Rails 3.0.9应用程序,从http://0.0.0.0:3000开始开发
=> Call with -d to detach
=>调用-d进行分离
=> Ctrl-C to shutdown server
=> Ctrl-C关闭服务器。
Exiting
退出
/Users/Moshe/Development/Ruby/hello/config/initializers/new_rails_defaults.rb:14: undefined method `generate_best_match=' for ActionDispatch::Routing:Module (NoMethodError)
/用户/ Moshe /开发/ Ruby / hello / config /初始化/ new_rails_defaults。rb:14: undefined method ' generate_best_match='用于ActionDispatch:::Routing:Module (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `load'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ activesupport-3.0.9 / lib / active_support /依赖性。rb:235:在“加载”
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `load'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ activesupport-3.0.9 / lib / active_support /依赖性。rb:235:在“加载”
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ activesupport-3.0.9 / lib / active_support /依赖性。rb:225:“load_dependency”
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ activesupport-3.0.9 / lib / active_support /依赖性。rb:596:“new_constants_in”
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ activesupport-3.0.9 / lib / active_support /依赖性。rb:225:“load_dependency”
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `load'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ activesupport-3.0.9 / lib / active_support /依赖性。rb:235:在“加载”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/engine.rb:201
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/ engine.rb:201
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/engine.rb:200:in `each'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/引擎。rb:200:“每一个”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/engine.rb:200
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/ engine.rb:200
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/ initializable。rb:25:在“instance_exec”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/ initializable。rb:25:在“运行”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `run_initializers'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/ initializable。rb:50:“run_initializers”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/ initializable。rb:49:“每一个”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib /铁路/ initializable。rb:49:“run_initializers”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib / rails应用程序。rb:134:在“初始化!”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `send'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib / rails应用程序。rb:77:在“发送”
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ railties-3.0.9 / lib / rails应用程序。rb:77:“method_missing”
from /Users/Moshe/Development/Ruby/hello/config/environment.rb:5
从/用户/ Moshe /开发/ Ruby / hello / config / environment.rb:5
from /Users/Moshe/Development/Ruby/hello/config.ru:3:in `require'
从/用户/ Moshe /开发/ Ruby / hello / config.ru:3:在“需要”
from /Users/Moshe/Development/Ruby/hello/config.ru:3
从/用户/ Moshe /开发/ Ruby / hello / config.ru:3
from /Library/Ruby/Gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ rack-1.2.3 / lib /架/建设者。rb:46:“instance_eval”
from /Library/Ruby/Gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
从/图书馆/ Ruby /珠宝/ 1.8 /珠宝/ rack-1.2.3 / lib /架/建设者。rb:46:在“初始化”
from /Users/Moshe/Development/Ruby/hello/config.ru:1:in `new'
从/用户/ Moshe /开发/ Ruby / hello / config.ru:1:在“新”
from /Users/Moshe/Development/Ruby/hello/config.ru:1
从/用户/ Moshe /开发/ Ruby / hello / config.ru:1
5 个解决方案
#1
3
I would try to start from scratch. Check which rvms you have installed:
我会试着从头开始。检查您安装了哪些rvms:
$rvm list
and you should get something like this:
你应该得到这样的东西:
rvm rubies
jruby-1.5.5 [ x86_64-java ]
ree-1.8.7-2010.02 [ x86_64 ]
ruby-1.8.6-p399 [ x86_64 ]
ruby-1.8.7-p299 [ x86_64 ]
=> ruby-1.8.7-p302 [ x86_64 ]
ruby-1.9.2-p0 [ x86_64 ]
Do a rvm uninstall on each piece:
在每个部件上卸载一个rvm:
$rvm uninstall 1.8.7
$rvm uninstall 1.9.2
Install Ruby 1.8.7:
安装Ruby 1.8.7:
$ rvm install 1.8.7
Install latest Ruby 1.9.2:
最新安装Ruby 1.9.2的:
$ rvm install 1.9.2
Set your default (or 1.8.7 if u want that):
设置您的默认值(如果您需要,可以设置为1.8.7):
$ rvm use 1.9.2 --default
Install PostgreSQL and SQLite gems (assume snow leopard):
安装PostgreSQL和SQLite gems(假设雪豹):
$ env ARCHFLAGS="-arch x86_64" gem install pg sqlite3-ruby
Install Rails 3 (includes Bundler):
安装Rails 3(包括Bundler):
$ gem install rails
If you are in a rails 2x project:
如果你在rails 2x项目中:
$rvm use 1.8.7
If you are in a rails 3 project:
如果您在rails 3项目中:
$rvm use 1.9.2
When you are in each rvm, load the gems associated to the project via 'bundle install' if you are using bundler, or 'rake gems:install' if you have everything dumped into your environment.rb
在每个rvm中,如果使用bundler或rake gems:install,则通过“bundle install”加载与项目相关的gem
#2
2
rm -rf .rvm .rvmrc
then delete the .rvmrc files in your project directory if you want to be sure you start from scratch.
然后删除项目目录中的.rvmrc文件,如果您想确保从头开始。
Unless you have installed a system wide ruby besides installing one via rvm you dont have a "ruby" command any more, until you reinstall rvm again.
除非您已经安装了一个系统范围的ruby,除了通过rvm安装之外,您将不再拥有“ruby”命令,直到您重新安装rvm。
So:
所以:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
to reinstall rvm. Now everything should be back to default install.
重新安装区。现在一切都应该回到默认安装。
#3
0
I did not remove any .rvm and .rvmrc file. But my problem has been solved. I dont know how it has been solved. But what step I did, I am telling you. First I used unstable version of rails gem in my Gemfile. That why problem is happening.
我没有删除任何.rvm和.rvmrc文件。但是我的问题已经解决了。我不知道是怎么解决的。但是我做了什么,我告诉你。首先,我在Gemfile中使用了不稳定版本的rails gem。这就是问题发生的原因。
gem 'rails', :path => '/home/user/life/rails' #this is an unstable rails 4.0.0 beta
#gem 'rails', '3.2.8'
user@sandip:~/life/samplelogin$ rails c
/home/user/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [activerecord-deprecated_finders-0.0.1, arel-3.0.2, atomic-1.0.1, builder-3.1.4, bundler-1.2.3, bundler-1.2.3, erubis-2.7.0, hike-1.2.1, i18n-0.6.1, json-1.7.5, mail-2.5.3, mime-types-1.19, minitest-4.3.3, multi_json-1.5.0, mysql2-0.3.11, polyglot-0.3.3, rack-1.4.1, rack-test-0.6.2, rake-10.0.3, rake-0.9.2, rdoc-3.12, sprockets-2.8.2, sprockets-rails-2.0.0.rc1, thor-0.16.0, thread_safe-0.1.0, tilt-1.3.3, treetop-1.4.12, tzinfo-0.3.35] (Gem::LoadError)
from /home/user/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/user/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /home/user/.rvm/gems/ruby-1.9.3-p362/bin/rails:18:in `<main>'
Then next step what i did, I just comment the gem from local folder.
接下来我要做的是,从本地文件夹注释gem。
#gem 'rails', :path => '/home/user/life/rails' #this is an unstable rails 4.0.0 beta'
gem 'rails', '3.2.8'
Then run the bundle install
然后运行bundle安装
then do
然后做
user@sandip:~/life/samplelogin$ rails c
Loading development environment (Rails 3.2.8)
1.9.3p362 :001 >
#4
0
this might be helpful:
这可能是有用的:
http://blog.parsalabs.com/blog/2013/08/27/setting-up-a-ruby-on-rails-4-development-environment-on-a-clean-mac-os-x-installation/
rbenv is an awesome tool to manage your rubies.
rbenv是一个很棒的工具来管理你的红宝石。
#5
0
Before you start again, take a look at RBENV as an alternative to RVM. Its a lot cleaner and easier to use.
在重新开始之前,先看看RBENV作为RVM的替代方案。它更干净更容易使用。
#1
3
I would try to start from scratch. Check which rvms you have installed:
我会试着从头开始。检查您安装了哪些rvms:
$rvm list
and you should get something like this:
你应该得到这样的东西:
rvm rubies
jruby-1.5.5 [ x86_64-java ]
ree-1.8.7-2010.02 [ x86_64 ]
ruby-1.8.6-p399 [ x86_64 ]
ruby-1.8.7-p299 [ x86_64 ]
=> ruby-1.8.7-p302 [ x86_64 ]
ruby-1.9.2-p0 [ x86_64 ]
Do a rvm uninstall on each piece:
在每个部件上卸载一个rvm:
$rvm uninstall 1.8.7
$rvm uninstall 1.9.2
Install Ruby 1.8.7:
安装Ruby 1.8.7:
$ rvm install 1.8.7
Install latest Ruby 1.9.2:
最新安装Ruby 1.9.2的:
$ rvm install 1.9.2
Set your default (or 1.8.7 if u want that):
设置您的默认值(如果您需要,可以设置为1.8.7):
$ rvm use 1.9.2 --default
Install PostgreSQL and SQLite gems (assume snow leopard):
安装PostgreSQL和SQLite gems(假设雪豹):
$ env ARCHFLAGS="-arch x86_64" gem install pg sqlite3-ruby
Install Rails 3 (includes Bundler):
安装Rails 3(包括Bundler):
$ gem install rails
If you are in a rails 2x project:
如果你在rails 2x项目中:
$rvm use 1.8.7
If you are in a rails 3 project:
如果您在rails 3项目中:
$rvm use 1.9.2
When you are in each rvm, load the gems associated to the project via 'bundle install' if you are using bundler, or 'rake gems:install' if you have everything dumped into your environment.rb
在每个rvm中,如果使用bundler或rake gems:install,则通过“bundle install”加载与项目相关的gem
#2
2
rm -rf .rvm .rvmrc
then delete the .rvmrc files in your project directory if you want to be sure you start from scratch.
然后删除项目目录中的.rvmrc文件,如果您想确保从头开始。
Unless you have installed a system wide ruby besides installing one via rvm you dont have a "ruby" command any more, until you reinstall rvm again.
除非您已经安装了一个系统范围的ruby,除了通过rvm安装之外,您将不再拥有“ruby”命令,直到您重新安装rvm。
So:
所以:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
to reinstall rvm. Now everything should be back to default install.
重新安装区。现在一切都应该回到默认安装。
#3
0
I did not remove any .rvm and .rvmrc file. But my problem has been solved. I dont know how it has been solved. But what step I did, I am telling you. First I used unstable version of rails gem in my Gemfile. That why problem is happening.
我没有删除任何.rvm和.rvmrc文件。但是我的问题已经解决了。我不知道是怎么解决的。但是我做了什么,我告诉你。首先,我在Gemfile中使用了不稳定版本的rails gem。这就是问题发生的原因。
gem 'rails', :path => '/home/user/life/rails' #this is an unstable rails 4.0.0 beta
#gem 'rails', '3.2.8'
user@sandip:~/life/samplelogin$ rails c
/home/user/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [activerecord-deprecated_finders-0.0.1, arel-3.0.2, atomic-1.0.1, builder-3.1.4, bundler-1.2.3, bundler-1.2.3, erubis-2.7.0, hike-1.2.1, i18n-0.6.1, json-1.7.5, mail-2.5.3, mime-types-1.19, minitest-4.3.3, multi_json-1.5.0, mysql2-0.3.11, polyglot-0.3.3, rack-1.4.1, rack-test-0.6.2, rake-10.0.3, rake-0.9.2, rdoc-3.12, sprockets-2.8.2, sprockets-rails-2.0.0.rc1, thor-0.16.0, thread_safe-0.1.0, tilt-1.3.3, treetop-1.4.12, tzinfo-0.3.35] (Gem::LoadError)
from /home/user/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/user/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /home/user/.rvm/gems/ruby-1.9.3-p362/bin/rails:18:in `<main>'
Then next step what i did, I just comment the gem from local folder.
接下来我要做的是,从本地文件夹注释gem。
#gem 'rails', :path => '/home/user/life/rails' #this is an unstable rails 4.0.0 beta'
gem 'rails', '3.2.8'
Then run the bundle install
然后运行bundle安装
then do
然后做
user@sandip:~/life/samplelogin$ rails c
Loading development environment (Rails 3.2.8)
1.9.3p362 :001 >
#4
0
this might be helpful:
这可能是有用的:
http://blog.parsalabs.com/blog/2013/08/27/setting-up-a-ruby-on-rails-4-development-environment-on-a-clean-mac-os-x-installation/
rbenv is an awesome tool to manage your rubies.
rbenv是一个很棒的工具来管理你的红宝石。
#5
0
Before you start again, take a look at RBENV as an alternative to RVM. Its a lot cleaner and easier to use.
在重新开始之前,先看看RBENV作为RVM的替代方案。它更干净更容易使用。