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! [email protected] start: `react-native-scripts start` npm ERR! Exit status 1 npm ERR! Failed at the [email protected] 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
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.
Check the ignore-script config If you see the start script is present inside your package. json file but still can't run the script, you need to check the console output. If there's no output at all, then you may have the ignore-scripts npm configuration set to true .
The React code should be fine.
Did you maybe move your project to another folder? Similar problem on github
Try the following:
rm -rf node_modules
npm install
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.
Date - 12 June, 2017
Just an FYI one liner -
Seems like npm5 is not stable yet. As mentioned by @jit in the comments. The problem was resolved after reverting to npm 4.6.1
npm install -g [email protected]
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With