I am trying to run npm install on my server and getting this error.
> node-cron@2.0.3 postinstall /home/workspace/AgreementCancellationProd/retrymechanism/node_modules/node-cron
> opencollective-postinstall
/usr/bin/env: node: Permission denied
npm WARN retrymechanism@1.0.0 No description
npm WARN retrymechanism@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! node-cron@2.0.3 postinstall: `opencollective-postinstall`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the node-cron@2.0.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-03-06T11_22_15_832Z-debug.log
NPM install is running fine on my local system but fails on server.
Also, when I try to install node-cron@2.0.3 using npm install node-cron@2.0.3
, it throws the same error.
I am using Amazon Linux
on EC2.
I've tried cleaning cache, deleting node_modules & package-lock.json and installing again. Nothing worked.
This is my package.json :
{
"name": "retrymechanism",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.16.4",
"fs": "0.0.1-security",
"mysql2": "^1.6.5",
"node-cron": "^2.0.3",
"request": "^2.88.0",
"sequelize": "^4.42.0"
}
}
What could be the problem? Please help!
答案 0 :(得分:2)
I ran into the same problem I used yarn
to solve the issue I think it's related to the npm
version :
yarn add node-cron@2.0.3
答案 1 :(得分:0)
Try to remove the "node-cron" from your package-json for a moment and then run npm install. If it works this way, there is a problem with node-cron and you might need to define a different version.
答案 2 :(得分:0)
对于使用 Jenkins 部署 React JS 应用程序时遇到相同问题的任何人,我即兴@oabarca's answer above都可以使用。只要确保您在chmod +x ./node_modules/.bin/react-scripts
之后和npm install
之前的npm run build
行是这样的:
pwd
npm install
chmod +x ./node_modules/.bin/react-scripts # add this line
npm run build
# ..rest of the code here
希望它可以为某人节省一些谷歌搜索时间;)