Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve npm error "npm ERR! code ELIFECYCLE"

People also ask

How resolve npm err code Elifecycle?

To Solve npm ERR! code ELIFECYCLE Error You Just need to run this command One by one. First of all Just delete package-lock. json file and then Run this command: npm cache clean –force Then Just run this command: npm install Now, You can Run Your Project with this command: npm start Now, Your Error must be solved.

How do I resolve npm start error?

To solve the Missing script: "start" error, make sure to add a start command to the scripts object in your package. json file and open your shell or IDE in the root directory of your project before running the npm start command.


Step 1: $ npm cache clean --force

Step 2: Delete node_modules by $ rm -rf node_modules (rmdir /S /Q node_modules in windows) folder or delete it manually by going into the directory and right-click > delete / move to trash. If are not updating your packages you can delete the package-lock.json file too.

Step 3: npm install

To start again, $ npm start

This worked for me. Hopes it works for you too.

PS: Still if it is there, kindly check the error it is displaying in red and act accordingly. This error is specific to node.js environment.


Cleaning Cache and Node_module are not enough. Follow this steps:

  • npm cache clean --force
  • delete node_modules folder
  • delete package-lock.json file
  • npm install

It works for me like this.


first i ran:

npm run clean

(even though it came with errors)

Then i deleted the node_modules folder and ran

npm install

This seems to have solved the problem.


I resolve this error running following code

npm cache clean

then delete node_modules directory from my project structure manually or with following command

rm -rf node_modules

After That install dependencies again using

npm install

I was getting similar error messages on a 16.04 Ubuntu instance with DigitalOcean while running npm run build on an app made with create-react-app (link). I upgraded the instance from 512MB RAM to 1GB ($5/mo to $10/mo) and then the script was able to run.

I post this here to point out that you may get this error due to resource limitations, which I didn't really see explained elsewhere on issue pages and SO answers. And nothing I saw in the error logs pointed me in this direction.


Change access in node_modules directory

chmod -R a+rwx ./node_modules