问题
I've just upgraded to Rails 3, using the instructions from this railscast. When I try to start the server, this is what happens:
$ rails s
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
I can't find this exact error using Google. Anyone know what is causing this? Thanks for reading
EDIT:
Here's the console output:
$ rvm 1.9.2
$ rails -v
Rails 3.0.1
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
$ rails new . -d sqlite3
(all the overwrite checking stuff happens here)
$ bundle install
...
Your bundle is complete! It was installed into /Users/ben/.rvm/gems/ruby-1.9.2-p0
$ rails s
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
$ rvm list
rvm rubies
=> ruby-1.9.2-p0 [ x86_64 ]
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
$ rails -v
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
回答1:
Have you actually installed the rails 3.0.x gem? Maybe you missed this step :).
It looks like your script/rails
script cannot find the included file from rails gem. You need to install all needed gems separately for each version of Ruby you're using (e.g. 1.8.7 and 1.9.2).
回答2:
Maybe you can just reinstall your rubygem, or update it.
Rubygem versions should fit to your Ruby versions. For every Ruby version you installed separated Gems needed.
May I ask did you use any 'sudo' with RVM installations? Better to avoid, see here: http://rvm.beginrescueend.com/rubies/rubygems/
Can you list here please your "gem list" after switched to default Ruby version you want to use? Also "rvm list" "ruby -v" "gem -v" and your OS please.
Also wise to write to forum at the section you downloaded Railscasts' video, because maybe others will have the same problem.
来源:https://stackoverflow.com/questions/4042471/error-when-trying-to-start-server-after-upgrading-to-rails-3