【问题标题】:Plesk install npm packages ErrorPlesk 安装 npm 包错误
【发布时间】:2017-09-21 18:30:02
【问题描述】:

我创建了一个使用 hummus.js 模块的 API。本地测试 -> 工作正常。

现在我上传了我的 API 并尝试运行 npm install 来安装所有依赖项。但我得到了这个错误:

npm-Installation
Execution filemng has failed with exit code 1, stdout:
> hummus@1.0.81 install /var/www/vhosts/XXX/XXX/node_modules/hummus
> node-pre-gyp install --fallback-to-build
, stderr: npm WARN lifecycle npm is using /opt/plesk/node/7/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
/usr/bin/env: 'node': No such file or directory
npm WARN XXX@0.0.1 No description
npm WARN XXX@0.0.1 No repository field.
npm WARN XXX@0.0.1 No license field.
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/opt/plesk/node/7/bin/node" "/opt/plesk/node/7/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! hummus@1.0.81 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the hummus@1.0.81 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hummus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hummus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hummus
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/vhosts/XXX/XXX/npm-debug.log

错误来自hummus-js 包。 所以我想尝试安装node-gypnpm install -g node-gyp)。但我不知道怎么做?在 Plesk 中,我无法安装单个模块。当我尝试使用 ssh 时,我得到了:

找不到命令 NPM

我是一名服务器管理员新手,所以我很高兴获得每一个帮助!

问候

编辑: 我的服务器 = Ubuntu 16.04 LTS 服务器 64 位 + Plesk Onyx

【问题讨论】:

  • “上传我的 API”是指尝试在(我假设的云)服务器上测试它还是?
  • 我有一个安装了 Plesk 的根服务器

标签: node.js npm plesk hummus.js


【解决方案1】:

如果我假设正确,归结为您没有在另一台机器上安装 Node。 SSH 进入机器,然后,对于 基于 debian 和 ubuntu 的操作系统运行

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

(再次假设您需要 Node 8.x),然后运行

sudo apt-get install -y build-essential

对于 CentOS 和其他企业 Linux 操作系统

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs
sudo yum install gcc-c++ make

然后尝试重做你所做的。

【讨论】:

  • 我安装了 Node Js(我使用 Plesk 安装它并启动我的 API。测试 api 运行良好(只是测试节点))但是使用 ssh 我找不到命令
  • 你可以通过 ssh 进入它并运行 'ls -l /opt/plesk/node',你应该在里面有一个名为 '7' 的文件夹。如果这样做,请运行:“echo 'export PATH=/opt/plesk/node/7/bin:$PATH' >> ~/.bashrc” 这很可能是本地安装的节点,因此您无法全局访问它。从理论上讲,这应该可以解决问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-08-01
  • 2020-11-10
  • 1970-01-01
  • 2017-10-04
  • 2016-08-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多