使用NVM的Phusion Passenger and Rails应用找不到JavaScript运行时 [英] Phusion Passenger and Rails app using NVM Could not find a JavaScript runtime

查看:61
本文介绍了使用NVM的Phusion Passenger and Rails应用找不到JavaScript运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Apache和Phusion Passenger部署Rails应用程序我已经使用此堆栈部署了应用程序,但是现在我正在使用NVM安装节点但是当我尝试加载网站时显示错误,在日志中查看时会显示此错误:

I'm deploying a rails app using Apache and Phusion Passenger I already deployed apps using this stack but now i'm using NVM to install node but when I try to load the site shows an error, looking on logs shows this error:

找不到JavaScript运行时.有关可用的运行时列表,请参见 https://github.com/rails/execjs .

Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.

在这台服务器上,我没有从OS repos安装nodejs,而查看乘客文档显示了有关passenger_nodejs的一些信息,但这是来自nginx.

On this server I didn't installed nodejs from OS repos, and looking on the passenger documentation shows something about passenger_nodejs but this is from nginx.

这是我来自apache的conf:

This is my conf from apache:

ServerName yourserver.com

ServerName yourserver.com

# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/myproj/public

PassengerRuby /home/appuser/.rvm/gems/ruby-2.3.0/wrappers/ruby
PassengerNodejs /home/appuser/.nvm/versions/node/v6.9.2/bin/node


# Relax Apache security settings
<Directory /var/www/myproj/public>
  Allow from all
  Options -MultiViews
  # Uncomment this if you're on Apache >= 2.4:
  Require all granted
</Directory>

并继续显示该错误

从OS repos安装nodejs可以修复该消息,并且该应用程序可以运行,但这是因为它使用的是OS中的节点版本,但是我想使用NVM版本.

Installing nodejs from OS repos fix the message and the app works but is because it's using the node version from OS but I want to use the NVM version.

推荐答案

我遇到了同样的问题,没有一个好的解决方案,但是我确实发现我可以通过创建如下符号链接来解决我的问题:

I have the same problem and don't have a good solution but I did find I was able to get around my problem by creating a symbolic link like:

ln -sf /home/deploy/.nvm/versions/node/v6.10.1/bin/node /usr/local/bin/node

如果同一台服务器上有多个部署,则无法很好地工作,但是我也找不到一种适当"地将NVM与乘客/铁路一起使用的方法.

Doesn't work very well if there are multiple deployments on the same server but I also couldn't find a way to "properly" use NVM with Passenger / Rails.

这篇关于使用NVM的Phusion Passenger and Rails应用找不到JavaScript运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆