2017-09-21 294 views
0

我創建了一個使用hummus.js模塊的API。本地測試 - >正常工作。Plesk安裝npm包錯誤

現在我上傳了我的API並嘗試運行npm install來安裝所有依賴項。但我得到這個錯誤:

npm-Installation 
Execution filemng has failed with exit code 1, stdout: 
> [email protected] 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 [email protected] No description 
npm WARN [email protected] No repository field. 
npm WARN [email protected] 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! [email protected] install: `node-pre-gyp install --fallback-to-build` 
npm ERR! spawn ENOENT 
npm ERR! 
npm ERR! Failed at the [email protected] 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嘗試它,我得到:

command NPM not found

我是一個服務器管理員,菜鳥,所以我很高興爲每一個幫助!

問候

編輯: 我的服務器= 16.04的Ubuntu LTS服務器64 +的Plesk瑪瑙 Plesk NodeJS

+0

通過「上傳我的API」,你的意思是試圖在(雲我假設)服務器上測試它或? –

+0

我有Plesk中的根服務器安裝 – Ckappo

回答

0

如果我正確的假設,把它歸結爲你沒有安裝在您的另一臺機器上的節點。 SSH到機器,那麼,對於Debian和Ubuntu爲基礎的OS運行

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

(假設,再次,如果您想節點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 

然後嘗試重做你做了什麼。

+0

我已經安裝了節點JS(我用的Plesk安裝它,並開始我的API。測試API效果很好(只是測試節點)),但使用ssh我已經找不到命令 – Ckappo

+0

你可以ssh進入它並運行'ls -l/opt/plesk/node',你應該有一個名爲'7'的文件夾。如果是這樣,請運行:「echo'export PATH =/opt/plesk/node/7/bin:$ PATH'>>〜/ .bashrc」 這很可能是本地安裝的節點,因此您無法訪問它全球。這應該從理論上解決問題。 –