How can I resolve 'npm ERR! code ELIFECYCLE' in Project.js during npm start

Viewed 28800

I was following the getting started with create react native app to create my first react native application. But I am getting the following error -

npm start
2:11:42 PM: Starting packager... 

2:11:46 PM: Error starting packager:
Error: Couldn't start project. Please fix the errors and restart the
project.

at /xdl/src/Project.js:1039:11
at Generator.next (<anonymous>)
at step (/Users/xyz/my-app/node_modules/xdl/build/Project.js:1461:191)
at /Users/xyz/my-app/node_modules/xdl/build/Project.js:1461:361
at <anonymous> 
npm ERR! code ELIFECYCLE 
npm ERR! errno 1 
npm ERR! my-app@0.1.0 start: `react-native-scripts start` 
npm ERR! Exit status 1 
npm ERR! Failed at the my-app@0.1.0 start script.

The line of code this trace is referring to in the file Project.js -

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

As suggested here npm ERR! code ELIFECYCLE I've tried to do a npm run clean and delete node_modules and npm install. But that didn't help either.

Version details -

āžœ npm -v
 5.0.1

āžœ node -v
v8.0.0
6 Answers

I wouldn't claim to entirely understand the solution. I think it had something to do with either incorrect addresses recorded to navigate node_modules, or it may have been my version of watchman was outdated or corrupted.

I fixed the issue by reinstalling watchman and deleting/recreating the node_modules and package-lock.json files.

npm cache clean --force

rm -rf node_modules

rm -rf package-lock.json

brew uninstall watchman

npm r -g watchman

npm install watchman

yarn

npm install

react-native link

npm start

Some of the steps might be expendable but it took me a long time so I wanted it to be watertight.

Good luck.

I tried all the above steps but the thing that work for me is to delete the "node_module" folder in home directory "C:\Users\musabarif\node_modules"

Make sure you have not installed something accidentally in your Home folder.

First of all check the Error in Red colored Text try to resolve that particular error and if any of above things didn't work then follow the following steps:

  1. Create a .env file in your Project folder

  2. Write SKIP_PREFLIGHT_CHECK=true in the file

  3. Save the file

  4. Try to run the project using npm start

I just changed the environment variable to c:\windows\system32 and it worked.

Steps to do so are:

  1. Go to the control panel
  2. Click on System
  3. Choose Advanced System Settings
  4. In the environment variables change the PATH to c:\windows\system32
Related