简体   繁体   English

试图让 nginx-passenger 使用 asdf 安装的 nodejs 而不是系统范围的安装

[英]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.

相关问题 asdf没有安装nodejs - asdf doesn't install nodejs npm install:如果存在则使用全局包,而不是安装两次 - npm install: Use global package if it exists, rather than installing twice 如何在NodeJ中使用本地软件包而不是远程软件包 - How to use local package rather than remote package in NodeJs 如何每次都引用本地安装的Angular2捆绑包而不是“ npm install”? - How to refer to local installed Angular2 bundle rather than “npm install” every time? 尝试获取openshift / nodejs上已安装模块的列表时出错 - Errors on trying to get a list of installed modules on openshift/nodejs 设置passenger_nodejs 在Nginx 服务器中不起作用 - Setting passenger_nodejs do not work in Nginx server 如何使用 asdf 在 Visual Studio Code 中使用 NodeJS 调试? (找不到运行时“节点”) - How to use NodeJS debugging in Visual Studio Code with asdf? (cannot find runtime 'node') 尝试在公司系统上使用“npm install”。出现以下错误 - Trying to use '' npm install" on company system. getting the following error 基于 Electron 的应用程序会通过系统范围的 nodejs 环境变量吗? - Will an Electron based app pass system wide nodejs environment variables? 查找已安装的NodeJS模块的文件系统位置 - Find the file system location of an installed NodeJS module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM