[英]Trying to get nginx-passenger to use asdf installed nodejs rather than system wide install
I am using asdf to install ruby for a rails app.我正在使用 asdf 为 rails 应用程序安装 ruby。 I am using nginx and passenger to serve the pages.
我正在使用 nginx 和乘客服务页面。 Passenger recognizes the asdf installation of ruby, but not nodejs.
乘客识别 ruby 的 asdf 安装,但不是 nodejs。
$ which node
/home/site/.asdf/shims/node
$ which ruby
/home/siite/.asdf/shims/ruby
excerpt from /etc/nginx/sites-enabled/mysite.com
摘自 /etc/nginx/sites-enabled/mysite.com
passenger_enabled on;
passenger_ruby /home/site/.asdf/shims/ruby;
passenger_nodejs /home/site/.asdf/shims/node;
rails_env production;
But when I try to boot the server, I get this error:但是当我尝试启动服务器时,我收到了这个错误:
App 18654 output: Error: The application encountered the following error: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
When I install nodejs with sudo apt-get install nodejs
, everything works.当我使用
sudo apt-get install nodejs
时,一切正常。
How can I use the asdf installation of nodejs to work with passenger in this fashion?如何使用 nodejs 的 asdf 安装以这种方式与乘客一起工作?
Clearly this has something to do with paths, naming or otherwise.显然,这与路径、命名或其他有关。 Rather than figuring out an elaborate way to solve this, I created a symlink in /usr/local/bin
我没有想出一个复杂的方法来解决这个问题,而是在 /usr/local/bin 中创建了一个符号链接
ln -s /home/site/.asdf/shims/node /usr/local/bin/nodejs
Now which nodejs
works, and the server boots.现在
which nodejs
工作,服务器启动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.