简体   繁体   中英

Ruby on rails - Error running rails s command

I installed the Rails installer in my Win7 machine from http://railsinstaller.org/ . I already had the Ruby 1.9.2-p290. After installing the ROR through the installer, I rain rails s to start the server and I get the following error. Could anybody help me understanding the reason of this error>?

C:\Sites\ridemo>rails s
=> Booting WEBrick
=> Rails 3.1.0.rc6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.1.0.rc6/lib/sp
rockets/railtie.rb:21:in `block (2 levels) in <class:Railtie>': undefined method
 `static_root=' for #<Sprockets::Environment:0x361d178> (NoMethodError)
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/sprockets-2.0.
0/lib/sprockets/environment.rb:55:in `initialize'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.1
.0.rc6/lib/sprockets/railtie.rb:20:in `new'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.1
.0.rc6/lib/sprockets/railtie.rb:20:in `block in <class:Railtie>'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/initializable.rb:25:in `instance_exec'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/initializable.rb:25:in `run'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/initializable.rb:50:in `block in run_initializers'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/initializable.rb:49:in `each'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/initializable.rb:49:in `run_initializers'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/application.rb:92:in `initialize!'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from C:/Sites/ridemo/config/environment.rb:5:in `<top (required)>'
        from C:/Sites/ridemo/config.ru:4:in `require'
        from C:/Sites/ridemo/config.ru:4:in `block in <main>'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.3.2/lib
/rack/builder.rb:51:in `instance_eval'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.3.2/lib
/rack/builder.rb:51:in `initialize'
        from C:/Sites/ridemo/config.ru:1:in `new'
        from C:/Sites/ridemo/config.ru:1:in `<main>'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.3.2/lib
/rack/builder.rb:40:in `eval'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.3.2/lib
/rack/builder.rb:40:in `parse_file'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.3.2/lib
/rack/server.rb:200:in `app'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/commands/server.rb:46:in `app'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.3.2/lib
/rack/server.rb:301:in `wrapped_app'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rack-1.3.2/lib
/rack/server.rb:252:in `start'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/commands/server.rb:70:in `start'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/commands.rb:54:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/commands.rb:49:in `tap'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.0
.rc6/lib/rails/commands.rb:49:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

RailsInstaller now supports Rails 3.1, but promise nothing about previous RC versions. Like @Fabio said, try to update to the latest Rails version (change it in your Gemfile). Also, if you already had a ruby version installed, be sure you are using the RailsInstaller one by checking your system environment path variable. The one and only path to Ruby should be :

C:\RailsInstaller\Ruby1.9.2\bin;

needed to run the following and It resolved the problem:-

gem install rails -v=3.1.0.rc8

From (https://github.com/sstephenson/sprockets/issues/172)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM