最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Getting "npm ERR! code ELIFECYCLE npm ERR! errno 126" while running npm install - Stack Overflow

programmeradmin2浏览0评论

I am trying to run npm install on my server and getting this error.

> [email protected] postinstall /home/workspace/AgreementCancellationProd/retrymechanism/node_modules/node-cron
> opencollective-postinstall

/usr/bin/env: node: Permission denied
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] postinstall: `opencollective-postinstall`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete 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 [email protected] using npm install [email protected], 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!

I am trying to run npm install on my server and getting this error.

> [email protected] postinstall /home/workspace/AgreementCancellationProd/retrymechanism/node_modules/node-cron
> opencollective-postinstall

/usr/bin/env: node: Permission denied
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] postinstall: `opencollective-postinstall`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete 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 [email protected] using npm install [email protected], 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!

Share Improve this question asked Mar 6, 2019 at 11:37 writeToBhuwanwriteToBhuwan 3,28111 gold badges42 silver badges67 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 5

I ran into the same problem I used yarn to solve the issue I think it's related to the npm version :

yarn add [email protected]

That error means one of your js files needs to be marked as executable. Try:

chmod +x src/index.js

For anyone having the same issue while deploying a React JS application with Jenkins, I improvised @oabarca's answer above and it worked. Just make sure you have this line chmod +x ./node_modules/.bin/react-scripts after npm install and before npm run build like this:

pwd
npm install
chmod +x ./node_modules/.bin/react-scripts   # add this line
npm run build
# ..rest of the code here

Hope it saves someone some Googling time ;)

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.

发布评论

评论列表(0)

  1. 暂无评论