我正在使用Capistrano和nginx部署我的rails应用程序,当我尝试查看该应用程序时,它没有启动,但出现了以下错误,尽管当我执行which node
时,我得到了这个提示:
/home/ubuntu/.nvm/versions/node/v8.0.0/bin/node
尽管已安装节点,但错误是:
Gem Load Error is: Node.js (V8) runtime is not available on this system
如果我在ExecJS.eval "'red yellow blue'.split(' ')"
上运行rails c
,则会得到预期的结果,因此ExecJS已经知道节点的安装位置。
编辑
PATH
已包含节点的路径
$ echo $PATH
/home/ubuntu/.nvm/versions/node/v8.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
我正在使用没有RVM的Ruby。
更多详细信息:
age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/my_app/current: The application encountered the following error: There was an error while trying to load the gem 'thredded'.
Gem Load Error is: Node.js (V8) runtime is not available on this system
Backtrace for gem load error is:
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:71:in `from_environment'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:57:in `autodetect'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.4.9/lib/autoprefixer-rails/processor.rb:2:in `<top (required)>'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.4.9/lib/autoprefixer-rails.rb:36:in `require_relative'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/autoprefixer-rails-9.4.9/lib/autoprefixer-rails.rb:36:in `<top (required)>'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/thredded-0.15.5/lib/thredded.rb:28:in `<top (required)>'
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `require'
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `each'
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `block in require'
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `each'
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `require'
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler.rb:114:in `require'
/var/www/my_app/releases/20190302100032/config/application.rb:8:in `<top (required)>'
/var/www/my_app/releases/20190302100032/config/environment.rb:3:in `require'
/var/www/my_app/releases/20190302100032/config/environment.rb:3:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/rack-1.6.8/lib/rack/builder.rb:55:in `instance_eval'
/var/www/my_app/shared/bundle/ruby/2.5.0/gems/rack-1.6.8/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
/usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
答案 0 :(得分:0)
根据execjs
源代码,很可能/home/ubuntu/.nvm/versions/node/v8.0.0/bin/node
不在您的PATH
中。您可以从PATH
(如shell
或echo $PATH
(如rails console
)中检查ENV['PATH'].split(File::PATH_SEPARATOR)
。如果您的node
路径不在您的路径中,则有两种方法。
在PATH
或node
目录中为/usr/bin
更新/usr/local/bin
或为PATH
创建符号链接,因为它们是componentDidMount() {
setTimeout(() => {
this._flatList.scrollToEnd();
}, 200);
}
中的默认目录。