我被困在Michael Hartl的Ruby on Ralis(第3版)Cloud 9上。
我试图让heroku应用程序运行,但我得到了:
应用错误
应用程序中发生错误,您的页面无法执行 提供服务。请稍后再试。
如果您是应用程序所有者,请查看日志以获取详细信息。
正如Chloe建议我改变'sass-rails'版本并更新'sass-rails'
Gemfile现在:
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'sass-rails', '5.0.3'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'pg', '0.17.1'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
正如这些秘密主管建议我使用the instructions given by heroku从sqlite3迁移到postgesql
捆绑安装:
Your Gemfile lists the gem pg (= 0.17.1) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.2
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.0
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.0
Using globalid 0.3.6
Using activejob 4.2.0
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.0
Using activemodel 4.2.0
Using arel 6.0.3
Using activerecord 4.2.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.3.pre1
Using columnize 0.9.0
Using debugger-linecache 1.2.0
Using slop 3.6.0
Using byebug 3.4.0
Using coffee-script-source 1.9.1.1
Using execjs 2.6.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.0
Using coffee-rails 4.1.0
Using multi_json 1.11.2
Using jbuilder 2.2.3
Using jquery-rails 4.0.3
Using pg 0.17.1
Using bundler 1.7.6
Using sprockets 3.4.0
Using sprockets-rails 2.3.3
Using rails 4.2.0
Using rdoc 4.2.0
Using sass 3.4.19
Using tilt 1.4.1
Using sass-rails 5.0.3
Using sdoc 0.4.0
Using spring 1.1.3
Using turbolinks 2.3.0
Using uglifier 2.5.3
Using web-console 2.0.0.beta3
Your bundle is complete!
Gems in the group production were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
heroku日志:
2015-11-07T04:01:15.515528+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `require'
2015-11-07T04:01:15.515529+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `<top (required)>'
2015-11-07T04:01:15.515530+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `require'
2015-11-07T04:01:15.515531+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `<top (required)>'
2015-11-07T04:01:15.515532+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
2015-11-07T04:01:15.515537+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
2015-11-07T04:01:15.515538+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
2015-11-07T04:01:15.515539+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
2015-11-07T04:01:15.515541+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
2015-11-07T04:01:15.515539+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
2015-11-07T04:01:15.515542+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
2015-11-07T04:01:15.515540+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
2015-11-07T04:01:15.515544+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-07T04:01:15.515542+00:00 app[web.1]: from /app/config/application.rb:7:in `<top (required)>'
2015-11-07T04:01:15.515543+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
2015-11-07T04:01:15.515545+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-07T04:01:15.515546+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-07T04:01:15.515546+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-07T04:01:15.515547+00:00 app[web.1]: from bin/rails:8:in `require'
2015-11-07T04:01:15.515548+00:00 app[web.1]: from bin/rails:8:in `<main>'
2015-11-07T04:01:16.156737+00:00 heroku[web.1]: Process exited with status 1
2015-11-07T04:01:16.180172+00:00 heroku[web.1]: State changed from starting to crashed
2015-11-07T09:53:24.813502+00:00 heroku[web.1]: State changed from crashed to starting
2015-11-07T09:53:26.649609+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 3154 -e production`
2015-11-07T09:53:28.640879+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails/helpers.rb:11:in `<top (required)>': uninitialized constant Sass::Script (NameError)
2015-11-07T09:53:28.640889+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `require'
2015-11-07T09:53:28.640890+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `<top (required)>'
2015-11-07T09:53:28.640891+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `require'
2015-11-07T09:53:28.640892+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `<top (required)>'
2015-11-07T09:53:28.640893+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
2015-11-07T09:53:28.640894+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
2015-11-07T09:53:28.640895+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
2015-11-07T09:53:28.640898+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
2015-11-07T09:53:28.640899+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
2015-11-07T09:53:28.640899+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
2015-11-07T09:53:28.640902+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
2015-11-07T09:53:28.640900+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
2015-11-07T09:53:28.640901+00:00 app[web.1]: from /app/config/application.rb:7:in `<top (required)>'
2015-11-07T09:53:28.640901+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
2015-11-07T09:53:28.640904+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-07T09:53:28.640903+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-07T09:53:28.640905+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-07T09:53:28.640904+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-07T09:53:28.640906+00:00 app[web.1]: from bin/rails:8:in `require'
2015-11-07T09:53:28.640908+00:00 app[web.1]: from bin/rails:8:in `<main>'
2015-11-07T09:53:29.330052+00:00 heroku[web.1]: State changed from starting to crashed
2015-11-07T09:53:29.312397+00:00 heroku[web.1]: Process exited with status 1
2015-11-07T15:29:39.760673+00:00 heroku[web.1]: State changed from crashed to starting
2015-11-07T15:29:41.134773+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 36601 -e production`
2015-11-07T15:29:42.344984+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails/helpers.rb:11:in `<top (required)>': uninitialized constant Sass::Script (NameError)
2015-11-07T15:29:42.344999+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `require'
2015-11-07T15:29:42.345000+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `<top (required)>'
2015-11-07T15:29:42.345000+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `require'
2015-11-07T15:29:42.345001+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `<top (required)>'
2015-11-07T15:29:42.345001+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
2015-11-07T15:29:42.345002+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
2015-11-07T15:29:42.345003+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
2015-11-07T15:29:42.345003+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
2015-11-07T15:29:42.345004+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
2015-11-07T15:29:42.345005+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
2015-11-07T15:29:42.345006+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
2015-11-07T15:29:42.345006+00:00 app[web.1]: from /app/config/application.rb:7:in `<top (required)>'
2015-11-07T15:29:42.345007+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
2015-11-07T15:29:42.345007+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
2015-11-07T15:29:42.345008+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-07T15:29:42.345008+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-07T15:29:42.345009+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-07T15:29:42.345009+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-07T15:29:42.345010+00:00 app[web.1]: from bin/rails:8:in `require'
2015-11-07T15:29:42.345010+00:00 app[web.1]: from bin/rails:8:in `<main>'
2015-11-07T15:29:42.853092+00:00 heroku[web.1]: State changed from starting to crashed
2015-11-07T15:29:42.835606+00:00 heroku[web.1]: Process exited with status 1
2015-11-07T19:33:16.727397+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview0&_c9_host=https://ide.c9.io" host=shrouded-savannah-6091.herokuapp.com request_id=9c198516-5ab2-46fa-bda4-47ee664e0fe1 fwd="90.192.204.238" dyno= connect= service= status=503 bytes=
2015-11-07T21:29:52.097847+00:00 heroku[web.1]: State changed from crashed to starting
2015-11-07T21:29:53.687754+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 31558 -e production`
2015-11-07T21:29:55.589151+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails/helpers.rb:11:in `<top (required)>': uninitialized constant Sass::Script (NameError)
2015-11-07T21:29:55.589184+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `require'
2015-11-07T21:29:55.589186+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `<top (required)>'
2015-11-07T21:29:55.589186+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `require'
2015-11-07T21:29:55.589188+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
2015-11-07T21:29:55.589187+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `<top (required)>'
2015-11-07T21:29:55.589187+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
2015-11-07T21:29:55.589189+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
2015-11-07T21:29:55.589188+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
2015-11-07T21:29:55.589190+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
2015-11-07T21:29:55.589191+00:00 app[web.1]: from /app/config/application.rb:7:in `<top (required)>'
2015-11-07T21:29:55.589189+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
2015-11-07T21:29:55.589190+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
2015-11-07T21:29:55.589192+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
2015-11-07T21:29:55.589192+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
2015-11-07T21:29:55.589193+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-07T21:29:55.589193+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-07T21:29:55.589197+00:00 app[web.1]: from bin/rails:8:in `<main>'
2015-11-07T21:29:55.589193+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-07T21:29:55.589194+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-07T21:29:55.589194+00:00 app[web.1]: from bin/rails:8:in `require'
2015-11-07T21:29:56.163038+00:00 heroku[web.1]: State changed from starting to crashed
2015-11-07T21:29:56.172834+00:00 heroku[web.1]: Process exited with status 1
2015-11-07T22:21:03.270746+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview0&_c9_host=https://ide.c9.io" host=shrouded-savannah-6091.herokuapp.com request_id=511497b3-bb4b-44e6-b57d-b07c88d59eff fwd="90.192.204.238" dyno= connect= service= status=503 bytes=
2015-11-07T22:43:47.751918+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview1&_c9_host=https://ide.c9.io" host=shrouded-savannah-6091.herokuapp.com request_id=2cf95f62-11ed-4a2e-83c0-e1db0e75dc9e fwd="90.192.204.238" dyno= connect= service= status=503 bytes=
2015-11-07T23:33:40.176852+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/?_c9_id=livepreview0&_c9_host=https://ide.c9.io" host=shrouded-savannah-6091.herokuapp.com request_id=73ebcd92-8883-4feb-b8a1-1ca06eeeca59 fwd="90.192.204.238" dyno= connect= service= status=503 bytes=
WARNING: Toolbelt v3.42.21 update available.
在heroku install
我看到我有sass-rails 5.0.3,但在heroku logs
中它仍然是5.0.1。
$ heroku open
:
Opening shrouded-savannah-6091... xprop: unable to open display ''
xprop: unable to open display ''
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 461: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening 'https://shrouded-savannah-6091.herokuapp.com/'
done
WARNING: Toolbelt v3.42.21 update available.
答案 0 :(得分:2)
最好关闭一个问题并提出另一个问题来解决问题。您的新错误是
/app/vendor/bundle/ruby/2.0.0/gems/sass-rails-5.0.1/lib/sass/rails/helpers.rb:11:in '<top (required)>': uninitialized constant Sass::Script (NameError)
看起来你没有运行Bundler,因为你仍在使用5.0.1。它可能是Sass宝石中的一个错误。尝试使用旧版本或更新版本的gem。查看您在本地安装的版本。
gem list sass-rails
尝试更新到最新的gem。我有5.0.3,最新版本是5.0.4。从Gemfile中删除版本并运行
bundle update
答案 1 :(得分:0)
如果一切正常在本地运行,我会跑:
heroku logs --tail
从您的终端然后重新加载页面。如果您查看日志,您应该更好地了解错误的确切含义。
答案 2 :(得分:0)
你的问题是heroku讨厌sqlite3
(读:不支持并且不允许你在你的应用中拥有宝石)。以下是他们要说的https://devcenter.heroku.com/articles/sqlite3。相反,我会迁移到postgesql。它对您的应用程序的运行方式没有任何影响,并且您在切换后没有注意到任何内容。我将heroku postgres用于我的数据库。要迁移,您应该按照我上面链接的文章中的说明进行操作。祝你好运!
您也可以通过按CTRL+C
更新1
要解决sass
错误,您可以使用this question。显然这是sass 5.0.1的一个问题,所以你只需要更新gem。
更新2
未在云端更新的宝石可能与this answer的答案有关。我不太了解云九,抱歉。