2014-04-11 71 views
4

我只是試圖通過railsapps.org Learn Ruby on Rails在線預訂。我已經安裝了所有東西,並停留在教程中的「啓動Web服務器」。無法啓動rails服務器 - 未初始化的常量Sprockets :: Rails :: VERSION :: :(NameError)

當我執行「$軌服務器」,我得到如下:

trick420$ rails server 
=> Booting WEBrick 
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000 
=> Run `rails server -h` for more startup options 
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option) 
=> Ctrl-C to shutdown server 
Exiting 
/Users/trick420/.rvm/gems/[email protected]/gems/sprockets-rails-2.1.2/lib/sprockets/railtie.rb:77:in `block in <class:Railtie>': uninitialized constant Sprockets::Rails::VERSION (NameError) 
from /Users/trick420/.rvm/gems/[email protected]/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:36:in `call' 
from /Users/trick420/.rvm/gems/[email protected]/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
from /Users/trick420/.rvm/gems/[email protected]/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks' 
from /Users/trick420/.rvm/gems/[email protected]/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:44:in `each' 
from /Users/trick420/.rvm/gems/[email protected]/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `each' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `call' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each' 
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!' 
from /Users/trick420/learn-rails/config/environment.rb:5:in `<top (required)>' 
from /Users/trick420/learn-rails/config.ru:3:in `require' 
from /Users/trick420/learn-rails/config.ru:3:in `block in <main>' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize' 
from /Users/trick420/learn-rails/config.ru:in `new' 
from /Users/trick420/learn-rails/config.ru:in `<main>' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/server.rb:199:in `app' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands/server.rb:50:in `app' 
from /Users/trick420/.rvm/gems/[email protected]/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands/server.rb:130:in `log_to_stdout' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands/server.rb:67:in `start' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!' 
from /Users/trick420/.rvm/gems/[email protected]/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>' 
from /Users/trick420/learn-rails/bin/rails:8:in `require' 
from /Users/trick420/learn-rails/bin/rails:8:in `<top (required)>' 
from /Users/trick420/.rvm/gems/[email protected]/gems/spring-1.1.2/lib/spring/client/rails.rb:27:in `load' 
from /Users/trick420/.rvm/gems/[email protected]/gems/spring-1.1.2/lib/spring/client/rails.rb:27:in `call' 
from /Users/trick420/.rvm/gems/[email protected]/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call' 
from /Users/trick420/.rvm/gems/[email protected]/gems/spring-1.1.2/lib/spring/client.rb:26:in `run' 
from /Users/trick420/.rvm/gems/[email protected]/gems/spring-1.1.2/bin/spring:48:in `<top (required)>' 
from /Users/trick420/.rvm/gems/[email protected]/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `load' 
from /Users/trick420/.rvm/gems/[email protected]/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `<top (required)>' 
from /Users/trick420/learn-rails/bin/spring:16:in `require' 
from /Users/trick420/learn-rails/bin/spring:16:in `<top (required)>' 
from bin/rails:3:in `load' 
from bin/rails:3:in `<main>' 

我已經沒有理想的是什麼問題,因爲我什麼都不知道的Rails或者Ruby在這一點上。很難進入,不是嗎?看起來,在寶石鏈輪軌道有一個問題,但我不知道如何處理,或從哪裏開始,因爲我甚至還沒有開始使用軌道。

回答

3

https://github.com/rails/sprockets-rails/issues/131

等待修復被釋放或簡單地添加到您的Gemfile

gem 'sprockets-rails', :require => 'sprockets/rails/version' 
+0

好了,如果我執行的代碼如上我得到:'-bash :sprockets/rails/version:沒有這樣的文件或目錄,我不能正確解釋上述指令嗎? – trick420

+0

@ trick420你需要將它添加到你的Gemfile中,而不是在命令行上運行它 – house9

+0

感謝您的幫助。我現在已經把我的導軌安裝架起來了,因爲我關閉了我的打開窗口,所以我不能繼續下去,直到我明白爲止。 – trick420

2

的修復程序sprokets護欄已添加。使用

gem update 

更新你的寶石。

鏈輪護欄應該在版本2.1.3

然後在你的Rails應用程序的Gemfile.lock的,修改下面一行到更新版本的寶石:

sprockets-rails (2.1.3) 

運行

bundle install 

,並在輸出,確認它說:

Using sprockets-rails 2.1.3 
+0

感謝您的幫助,我不小心關閉了我的bash窗口,現在它告訴我沒有安裝軌道,所以我無法通過軟件包安裝...返回到繪圖板。 – trick420

2

2014年4月11日,sprockets-rails團隊發佈了sprockets-rails gem的破碎版本(版本2.1.2)。他們在同一天晚些時候發佈了固定版本2.1.3。

如果您已關閉終端窗口,請打開一個新窗口,並使用Unix「cd」命令導航到要構建Rails應用程序的項目目錄。更新鏈輪軌道寶石(和任何其他過時的):

$ bundle update 

然後,你可以繼續你在哪裏。

與學習Rails祝好運(它並不總是這麼難)。歡迎來到Stack Overflow。一定要選擇一個正確的答案來鼓勵已經幫助過的人。

0

我有我的鏈輪寶石明確添加到Gemfile中使用的版本號,以得到它的工作,即

gem 'sprockets', '~> 2.2.1' 
相關問題