我尝试使用capistrano
将我的应用部署到服务器。我在我的服务器上安装了nodejs,它正在运行。但是当我运行cap production deploy
时,我收到以下错误:
[6c68298e] Command: cd /home/deploy/myapp/releases/20150518162617 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
DEBUG [6c68298e] rake aborted!
DEBUG [6c68298e] ExecJS::RuntimeError:
DEBUG [6c68298e] (in /home/deploy/myapp/releases/20150518162617/app/assets/javascripts/application.js)
DEBUG [6c68298e] (execjs):1
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:207:in `exec_runtime'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:32:in `exec'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:21:in `eval'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:39:in `call'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:212:in `run_uglifyjs'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:179:in `compile'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/uglifier_compressor.rb:25:in `evaluate'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:25:in `initialize'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
DEBUG [6c68298e] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
DEBUG [6c68298e] Tasks: TOP => assets:precompile
DEBUG [6c68298e] (See full trace by running task with --trace)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@46.101.34.93: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
ExecJS::RuntimeError:
(in /home/deploy/myapp/releases/20150518162617/app/assets/javascripts/application.js)
(execjs):1
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:207:in `exec_runtime'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:32:in `exec'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:21:in `eval'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:39:in `call'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:212:in `run_uglifyjs'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:179:in `compile'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/uglifier_compressor.rb:25:in `evaluate'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:25:in `initialize'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:211:in `block in find_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:257:in `benchmark'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:210:in `find_asset'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:119:in `block in compile'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `each'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/manifest.rb:118:in `compile'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/rake/sprocketstask.rb:146:in `with_logger'
/home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
然后我尝试安装therubyracer
gem。这给了我一个新的错误:
DEBUG [162e60db] Command: cd /home/deploy/myapp/releases/20150518163910 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
DEBUG [162e60db] /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/lib/v8/function.rb:13: [BUG]
DEBUG [162e60db] Segmentation fault at 0x000b4dd50076c1
DEBUG [162e60db] ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
DEBUG [162e60db]
DEBUG [162e60db] bash: line 1: 1381 Killed ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@46.101.34.93: rake exit status: 137
rake stdout: Nothing written
rake stderr: /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/lib/v8/function.rb:13: [BUG] Segmentation fault at 0x000b4dd50076c1
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
bash: line 1: 1381 Killed ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
SSHKit::Command::Failed: rake exit status: 137
rake stdout: Nothing written
rake stderr: /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/lib/v8/function.rb:13: [BUG] Segmentation fault at 0x000b4dd50076c1
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
bash: line 1: 1381 Killed ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@46.101.34.93: rake exit status: 137
rake stdout: Nothing written
rake stderr: /home/deploy/myapp/shared/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/lib/v8/function.rb:13: [BUG] Segmentation fault at 0x000b4dd50076c1
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
bash: line 1: 1381 Killed ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.2 RAILS_ENV=production ~/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
我甚至尝试重新安装节点并安装其他版本。但仍然没有奏效。可能是什么问题?我该如何解决?
答案 0 :(得分:2)
检查是否安装了nodejs,如果不是
sudo apt-get install nodejs
如果问题仍然存在,请尝试重新启动服务器。