2014-01-21 77 views
0

我試圖安裝色器件寶石,當我做是什麼在色器件initialation這個錯誤意味着

$ rails generate devise: install 

我得到以下錯誤:

/usr/local/rvm/gems/ruby-2.0.0-p353/gems/devise-3.1.2/lib/devise/rails/routes.rb:440:in `raise_no_secret_key': Devise.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError) 

    config.secret_key = '964705f2d08f9196c511948baa14a1ef2ba7693b6eb326f9b177a1377d2c8487aab5736798e4bae6286eb0e36298eac3bceff31be5c357d356db8a22edd04a4d' 

Please ensure you restarted your application after installing Devise or setting the key. 
    from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/devise-3.1.2/lib/devise/rails/routes.rb:195:in `devise_for' 
    from /Users/Katy/Desktop/pinteresting/config/routes.rb:2:in `block in <top (required)>' 
    from /usr/local/rvm/gems/[email protected]/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec' 
    from /usr/local/rvm/gems/[email protected]/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `eval_block' 
    from /usr/local/rvm/gems/[email protected]/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in `draw' 
    from /Users/Katy/Desktop/pinteresting/config/routes.rb:1:in `<top (required)>' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `each' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `load_paths' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:in `block in updater' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `call' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `execute' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:in `updater' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers' 
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each' 
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component' 
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from' 
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component' 
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in `each' 
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component' 
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing' 
    from /Users/Katy/Desktop/pinteresting/config/environment.rb:5:in `<top (required)>' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency' 
    from /usr/local/rvm/gems/[email protected]/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!' 
    from /usr/local/rvm/gems/[email protected]/gems/railties-4.0.2/lib/rails/commands.rb:44:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

有什麼想法?

+0

爲什麼不讀錯誤信息?這是字面上告訴你該怎麼做。將'config.secret_key ='964705f2d08f9196c511948baa14a1ef2ba7693b6eb326f9b177a1377d2c8487aab5736798e4bae6286eb0e36298eac3bceff31be5c357d356db8a22edd04a4d''添加到您的devise.rb文件。 – Ashitaka

+0

此外,谷歌搜索的錯誤消息將返回http://stackoverflow.com/questions/18080910/devise-secret-key和http://stackoverflow.com/questions/20873524/trouble-installing-devise-gem – Ashitaka

回答

0

此錯誤發生是因爲新的設計版本,您可能正在升級寶石版本。 加入這行到你的config /初始化/ devise.rb文件

config.secret_key = '964705f2d08f9196c511948baa14a1ef2ba7693b6eb326f9b177a1377d2c8487aab5736798e4bae6286eb0e36298eac3bceff31be5c357d356db8a22edd04a4d' 

類型:生成另一個secrect_key你的Ruby控制檯上insted的這一老一

,你可以這樣做:

rake secret 

然後將散列複製到您的初始化程序中

@Ashitaka的榮譽

+0

'耙祕密命令也很方便。 – Ashitaka

+1

去編輯anwser :) –

0

開放寶石文件,加入這一行gem 'devise'

.........打開終端輸入bundle install

現在再次輸入端子rails generate devise:install