代码之家  ›  专栏  ›  技术社区  ›  simo

Gem加载错误为:Node。js(V8)运行时在此系统上不可用

  •  0
  • simo  · 技术社区  · 7 年前

    我正在使用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 回复  |  直到 7 年前
        1
  •  0
  •   zeitnot    7 年前

    很可能 /home/ubuntu/.nvm/versions/node/v8.0.0/bin/node 不在你的房间里 PATH 根据 execjs 源代码。你可以查一下 路径 要么来自 shell 喜欢 echo $PATH rails console 喜欢 ENV['PATH'].split(File::PATH_SEPARATOR) .如果你的 node 道路不在你的道路上,那么有两种方法。

    更新 路径 或者为你的网站创建一个符号链接 节点 在…内 /usr/bin /usr/local/bin 目录,因为它们在 路径 .