React - npm start fails with error - node.js

NPM start throwing the following error
events.js:160
throw er; // Unhandled 'error' event
^
Error: Error watching file for changes: EMFILE
at exports._errnoException (util.js:1022:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)
I have tried
rm -rf node-modules/
npm install
npm run build
but the error still occurs.

This looks to be a similar issue with the same solution as that for which I answered here
You have to install watchman with brew install watchman.

Related

Why npm start is getting error for react project?

I'm trying to start a React application, with npm but I get this error:
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
I'm using node version 10.16.3 and npm 6.13.6. I've cleaned npm cache and install npm again, but I'm getting always the same error
I suggest doing these three steps:
npm install -g npm#latest to update npm because it is sometimes buggy.
rm -rf node_modules to remove the existing modules.
npm install to re-install the project dependencies.
the problem is fixed , i've installed another version of "react-scripts" , because the actuel version is not stable , so i use to overwrite it with the given version, so use this command to install :
npm install react-scripts#2.1.8
Once the installation is completed your can run your reac app :
npm start

Unhandled error event with ionic serve

This is the error
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn C:\Program Files (x86)\nodejs\node.exe ENOENT
at notFoundError (E:\IonicProjects\projectapp\ionic3\node_modules\cross-spawn\lib\enoent.js:11:11)
at verifyENOENT (E:\IonicProjects\projectapp\ionic3\node_modules\cross-spawn\lib\enoent.js:46:16)
at ChildProcess.cp.emit (E:\IonicProjects\projectapp\ionic3\node_modules\cross-spawn\lib\enoent.js:33:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
I don't get why this error is happening, I've been working on this project for a while and now only with this project is giving to me this error, I've tested with other project that I had made and it serves OK, I've read about ENOENT but I don't get why I have to add code on my project if NEVER I've changed libraries or something.
Note: I'm runing a Windows 10
I solved this issue by:
1. clearing npm cache , run the following commands:
npm cache clean -f
npm install npm -g
Then:
2. catch the exceptions on your code, it also thrown when there is un-catched exceptions.

react native windows, spawn npm ENOENT error

I am trying to run react-native on windows and get the following error:
C:\Program Files>react-native init AwesomeProject
This will walk you through creating a new React Native project in
C:\Program Fil es\AwesomeProject Installing react-native package from
npm... events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at exports._errnoException (util.js:860:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:450:9)
at process._tickCallback (node.js:364:17)
at Function.Module.runMain (module.js:459:11)
at startup (node.js:136:18)
at node.js:972:3
How do I fix this?
This should be fixed in React Native CLI 0.1.9. To update your CLI:
npm uninstall -g react-native-cli
npm install -g react-native-cli
There was a regression in 0.1.8, reported here: https://github.com/facebook/react-native/issues/5169
Check if the gradlew.bat file is present in the android folder if it is not there then simply copy gradlew.bat file from another project.
react-native-cli#0.1.8 error
Rollback react-native-cli#0.1.7
everything is ok.
To fix this, Reinstall NodeJS https://nodejs.org/en/
Then
npm install -g react-native-cli --vebrose
react-native init App --verbose
If it still fails, try installing Python 3 https://www.python.org/ and repeat the process.

SpookyJS example/hello.js fails with "throw er; // Unhandled 'error' event"

When I run the hello example from SpookyJS, it fails with the following error:
$ node examples/hello.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:998:11)
at Process.ChildProcess._handle.onexit (child_process.js:789:34)
In fact, all examples that I tried result in this error. I'm stuck, as I cannot interpret the error message even when looking into the source code. Do you have any ideas?
(I'm using Ubuntu with phantomjs 1.9.7)
Solution: npm install -g casperjs
I assumed that it is enough to call npm install locally, but casperjs must be in the path. After I installed casperjs globally, the example worked fine.

Node.js SpookyJS: error executing hello.js

I have installed SpookyJS to execute CasperJs commands in Node.js. I Installed it with this command: npm install spooky, I´m using a Centos machine.
the error:
$ node node_modules/spooky/examples/hello.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
Thanks in advance

Resources