Gatsby: events.js:182 throw er; // Unhandled 'error' event

Created on 11 Aug 2017  ·  75Comments  ·  Source: gatsbyjs/gatsby

After command, gatsby develop (npm run develop) I have got an error.
Please, help.

Your site is running at http://localhost:8000
I Your graphql debugger is running at http://localhost:8000/___graphql
events.js:182
throw er; // Unhandled 'error' event
^

Error: watch /data/home/user/Sasha/Gatsbyjs/node_modules/babel-polyfill/node_modules/core-js/library/fn/array ENOSPC
at exports._errnoException (util.js:1024:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/data/home/user/Sasha/Gatsbyjs/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/data/home/user/Sasha/Gatsbyjs/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/data/home/user/Sasha/Gatsbyjs/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/data/home/user/Sasha/Gatsbyjs/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher. (/data/home/user/Sasha/Gatsbyjs/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher. (/data/home/user/Sasha/Gatsbyjs/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:153:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] develop: gatsby develop
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /data/home/user/.npm/_logs/2017-08-11T06_20_35_175Z-debug.log

Most helpful comment

This fix for me:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Source: Node.JS Error: ENOSPC

All 75 comments

I am am having what seems to be the same issue. Any ideas about of what's going on here?

 DONE  Compiled successfully in 317ms                                11:09:48 PM

 I  Your site is running at http://localhost:8000
 I  Your graphql debugger is running at http://localhost:8000/___graphql
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: watch /home/username/_Code/project-dir/node_modules/find-node-modules/test/b/c/d/e/f ENOSPC
    at exports._errnoException (util.js:1020:11)
    at FSWatcher.start (fs.js:1443:19)
    at Object.fs.watch (fs.js:1470:11)
    at createFsWatchInstance (/home/username/_Code/project-dir/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/username/_Code/project-dir/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/username/_Code/project-dir/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/username/_Code/project-dir/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/home/username/_Code/project-dir/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/home/username/_Code/project-dir/node_modules/chokidar/lib/nodefs-handler.js:460:16)

NOTE:

  • I have enough space on disk
  • removing ~/.npm/tmp didn't work
  • rm -rf node_modules && npm cache clean && npm installdidn't work
  • port is not in use (netstat -nltp)

the old "reboot the system" fixed it...

EDIT: I am having this issue again :/

Might want to check out https://github.com/facebook/jest/issues/3254 @sotocodes

I also got error with chokidar and this error code migrating from a hugo site with nested folders in static after forestry handles assets like this.
The linux-specific command for fs worked.

For what it's worth, I ran npm install npm update and it works again.

I have The same error !!

Closing older issues, please open new issues if you need more help!

Your site is running at http://localhost:8000
Try changing your port. Like 3000 or 8080.

app.listen(3000)

My 8080 post was taken, so I got this same error

i also have the issue with the

events.js:137
throw er; // Unhandled 'error' event

This happens when I try to create-react-app and also I am not able to run react app

events.js:167
throw er; // Unhandled 'error' event
^

Error: spawn C:Program Filesnodejs ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:217:19)
at onErrorNT (internal/child_process.js:394:16)
at process._tickCallback (internal/process/next_tick.js:174:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:223:12)
at onErrorNT (internal/child_process.js:394:16)
at process._tickCallback (internal/process/next_tick.js:174:19)
help me resolve the issue
getting this error after running ng new command

Changing the port number worked for me

image

What is this error?!

In my MAC, I ran "killall node" and "yarn start" (or npm start) and everything is fine now.

@juliancorrea thanks man. executing killall node solved my problem, as well

npm install fixed it for me

events.js:167
throw er; // Unhandled 'error' event
^

Error: EACCES: permission denied, open '/data/data/com.termux/files/home/hexoproject/source/_posts/科学上网软件ss系列.md'
Emitted 'error' event at:
at /data/data/com.termux/files/home/hexoproject/node_modules/graceful-fs/graceful-fs.js:190:14
at /data/data/com.termux/files/home/hexoproject/node_modules/graceful-fs/graceful-fs.js:241:16
at FSReqWrap.oncomplete (fs.js:141:20)
%

All you have to do is close all other open terminals.

Also in my case I had working through Intellij, and when ever I closed the terminal, i had to make my way back to the folder with the js file.

This fix for me:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Source: Node.JS Error: ENOSPC

if you are on node project, kindly change the port number. if it was port Listen="3004", make it port listing ="3005"

After closed the Intellij idea my problem solved.

image

i got this error , Please help me.

@kw3ku be right, in my case used port 80 i changed to 3000 it running normally now.

@kw3ku be right, in my case used port 80 i changed to 3000 it running normally now.

Right!My project port number changed to 3200 just fine. Previously number 9080.

image

i got this error , Please help me.

I am getting the same issue. Did you get any fix for this ?

This fix for me:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Source: Node.JS Error: ENOSPC
it works for me also

Run killall node
and start your app

Just change the door, in my case change to 8080 and function

I've run into this issue a handful of times and it always leads to something is running on that port. So just make sure to kill the PID running on that port

Find the PID:
lsof -i :3000

Kill:
kill -9 <PID>

In my MAC, I ran "killall node" and "yarn start" (or npm start) and everything is fine now.

Yep, it works for me. Thanks, man.

I have an error while running my react code on visual studio. How do you handle the below error???

events.js:174
throw er; // Unhandled 'error' event
^

Error: listen EACCES: permission denied 127.0.0.1:8080
at Server.setupListenHandle [as _listen2] (net.js:1253:19)
at listenInCluster (net.js:1318:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
Emitted 'error' event at:
at emitErrorNT (net.js:1297:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: webpack-dev-server --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@nehakuragayala could be an error with the npm global config. Take a look at Error: EACCES: permission denied

at linux - sudo npm install then change port, or closing existing server at this port.
that how i fixed it

For what it's worth, I ran npm install npm update and it works again.

I had the same error

ng build --prod && electron .

Date: 2019-04-11T09:37:41.804Z
Hash: 339909bc988fb9628a0e
Time: 16126ms
chunk {scripts} scripts.5994b0d4263eaf6f8498.bundle.js (scripts) 207 kB [initial] [rendered]
chunk {0} main.1eca2b65ad0743f06cc3.bundle.js (main) 867 kB [initial] [rendered]
chunk {1} polyfills.1457c99db4b6dba06e8d.bundle.js (polyfills) 59.4 kB [initial] [rendered]
chunk {2} styles.67e6dcccd1a619e76bae.bundle.css (styles) 175 kB [initial] [rendered]
chunk {3} inline.318b50c57b4eba3d437b.bundle.js (inline) 796 bytes [entry] [rendered]
events.js:183
throw er; // Unhandled 'error' event
^

Error: spawn /Users/xx/xx/xx/xx/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:678:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3

But using npm update and npm install solved my problem
Thanks

I have an error while running my react code on visual studio. How do you handle the below error???

events.js:174
throw er; // Unhandled 'error' event
^

Error: listen EACCES: permission denied 127.0.0.1:8080
at Server.setupListenHandle [as _listen2] (net.js:1253:19)
at listenInCluster (net.js:1318:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
Emitted 'error' event at:
at emitErrorNT (net.js:1297:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: webpack-dev-server --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

This might be because your project port number and live-server port number are different

An easier way around this (if you are using vs code) is to install the live server extension
After that right click the file you want to open and select 'Open with live server'
In my opinion, that's much easier than changing the default port number of every project
Hope that helps

For what it's worth, I ran npm install npm update and it works again.

This one worked for me

I run into this issue, It is simply to clean the app/build dir. That will resolve the problem.

I had another node development server running in another terminal, once I closed that this error was fixed.

This is happening to me as well any help tried the above solutions I am on windows.

```events.js:187
throw er; // Unhandled 'error' event
^

Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:3000/' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersTaslimAppDataRoamingnpm-cache_logs2019-10-24T21_26_11_139Z-debug.log
```

I fixed my issue on windows by adding
C:\Program Files\nodejs
&&
C:\Windows\System32
to my Systems Variables and restarted my VS Code and its working again. Hope this helps anyone.

why this error is happening while running my react code on visual studio

D:reactapp>npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:reactapppackage.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:reactapppackage.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersNandanAppDataRoamingnpm-cache_logs2019-10-25T11_01_18_519Z-debug.log

D:reactapp>

CHROMEDRIVER_FORCE_DOWNLOAD=true npm install chromedriver
fixed it for me.
source:
https://www.npmjs.com/package/chromedriver

Because I've run it twice. Make sure you run once

I am getting the same issue and i could not find any accurate answer plz help me.
image

Delete node_modules
Then run npm install

Worked for me

clear node_modules folder , run yarn again works for me .

Your site is running at http://localhost:8000
Try changing your port. Like 3000 or 8080.

app.listen(3000)

My 8080 post was taken, so I got this same error

Had the same issue! Just run sudo npm start instead of npm start and it worked! ;-)

Due to some reason in my system variables my path was not set.
Set this to System variables:
%SystemRoot%\system32

In case it doesn't work, try killing your port already under use. (Source)
netstat -ano | findstr :yourPortNumber
taskkill /PID typeyourPIDhere /F

i am trying to install reactjs but always i got this error .one step before npm start
error

error

In my case, I resolved it by following steps

  1. Delete node module files
  2. Change in pakage.json
    "react-scripts": "3.4.1" to "react-scripts": "1.1.1"
  3. than use npm install

Thanks.And through which tutorial you install ReactJs?

On Mon, Mar 30, 2020 at 9:58 AM Ashish Agrawat notifications@github.com
wrote:

In my case, I resolved it by following steps

  1. Delete node module files
  2. Change in pakage.json
    "react-scripts": "3.4.1" to "react-scripts": "1.1.1"
  3. than use npm install


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-605782482,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZMHTEQZUDRLTUBHDVLRKARINANCNFSM4DWRE5IA
.

@muqadas12 .... I followed react js official doc

OK!.Thanks a lot

On Mon, Mar 30, 2020 at 10:41 AM Ashish Agrawat notifications@github.com
wrote:

@muqadas12 https://github.com/muqadas12 .... I followed react js
official doc


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-605793358,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZPOKKYL5XZRY34CNVDRKAWJJANCNFSM4DWRE5IA
.

it doesn't work .Giving same error again

On Mon, Mar 30, 2020 at 9:58 AM Ashish Agrawat notifications@github.com
wrote:

In my case, I resolved it by following steps

  1. Delete node module files
  2. Change in pakage.json
    "react-scripts": "3.4.1" to "react-scripts": "1.1.1"
  3. than use npm install


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-605782482,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZMHTEQZUDRLTUBHDVLRKARINANCNFSM4DWRE5IA
.

I had an error like this and believe I caused it by moving the mySQL Server 8.0 folder outside of the MySQL folder into Program Files. (I originally did this because using mySQL in command line was annoying typing mySQL and then mySQL Server 8.0).
I solved it by using the mySQL installer and it worked!

events.js:167
throw er; // Unhandled 'error' event
^

Error: spawn C:Program Filesnodejs ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:217:19)
at onErrorNT (internal/child_process.js:394:16)
at process._tickCallback (internal/process/next_tick.js:174:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:223:12)
at onErrorNT (internal/child_process.js:394:16)
at process._tickCallback (internal/process/next_tick.js:174:19)
help me resolve the issue
getting this error after running ng new command

npm install -g serve (si te sale error no importa)
despues
npm start

service docker restart !

npm install react-scripts --save

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
This worked for me

This fix for me:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Source: Node.JS Error: ENOSPC

I have no idea what this does, but IT WORKED!!! Thanks

Try to change port no : 3000 to 8080
Working fine.
**

app.listen(8080)

**

All you have to do is close all other open terminals.

Also in my case I had working through Intellij, and when ever I closed the terminal, i had to make my way back to the folder with the js file.

I did exactly this and it works now. Any idea why this might be happening?

No I have no idea about this

On Mon, Jun 29, 2020 at 6:06 PM Vaibhav Ahuja notifications@github.com
wrote:

All you have to do is close all other open terminals.

Also in my case I had working through Intellij, and when ever I closed the
terminal, i had to make my way back to the folder with the js file.

I did exactly this and it works now. Any idea why this might be happening?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-651107887,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZKWTLW32LLACXCASU3RZCGVDANCNFSM4DWRE5IA
.

I am facing this problem when i was using command: browser-sync start --server --directory --files "*/"
This error is occurring, because we are not in working directory, i changed the working directory, typed command again and it worked fine.

OK.Thanks

On Mon, Jul 20, 2020 at 4:08 PM M-Hasnain notifications@github.com wrote:

I am facing this problem when i was using command browser-sync start
--server --directory --files "*/"
This error is occurring, because we are not in working directory, i
changed the working directory, typed command again and it worked fine.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-660961517,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZLUXWVWXXA3R7DIQGLR4QQSPANCNFSM4DWRE5IA
.

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

its work for me thanks

events.js:292
throw er; // Unhandled 'error' event

please solve these error earliest

Event.js:292
Throw er; // unhandled 'error' event
How to solve this error

In my case the problem was due to path variable.i haven't set the path
after setting it I didn't receive this error

On Mon, 24 Aug 2020, 8:05 PM Paridhinigam, notifications@github.com wrote:

Event.js:292
Throw er; // unhandled 'error' event
How to solve this error


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-679183060,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZJTM3KWZFQEPACIISTSCJ6THANCNFSM4DWRE5IA
.

In my case the problem was due to path variable.i haven't set the path after setting it I didn't receive this error

On Mon, 24 Aug 2020, 8:05 PM Paridhinigam, @.*> wrote: Event.js:292 Throw er; // unhandled 'error' event How to solve this error — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1767 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONDSZJTM3KWZFQEPACIISTSCJ6THANCNFSM4DWRE5IA .

Thankyou so much.... can you help me ..how to set the path.

Go to This pc
then properties
then Environment variable
and add the path of node js there

On Mon, Aug 24, 2020 at 6:58 PM Paridhinigam notifications@github.com
wrote:

In my case the problem was due to path variable.i haven't set the path
after setting it I didn't receive this error
… <#m_2070613592314803608_>
On Mon, 24 Aug 2020, 8:05 PM Paridhinigam, @.*> wrote: Event.js:292
Throw er; // unhandled 'error' event How to solve this error — You are
receiving this because you were mentioned. Reply to this email directly,
view it on GitHub <#1767 (comment)
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-679183060>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZJTM3KWZFQEPACIISTSCJ6THANCNFSM4DWRE5IA
.

Thankyou so much.... can you help me ..how to set the path.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/1767#issuecomment-679456902,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AONDSZN2BVYAHLNHJBV4U2TSCMLFXANCNFSM4DWRE5IA
.

Go to This pc then properties then Environment variable and add the path of node js there On Mon, Aug 24, 2020 at 6:58 PM Paridhinigam notifications@github.com wrote:

In my case the problem was due to path variable.i haven't set the path after setting it I didn't receive this error … <#m_2070613592314803608_> On Mon, 24 Aug 2020, 8:05 PM Paridhinigam, @.*> wrote: Event.js:292 Throw er; // unhandled 'error' event How to solve this error — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1767 (comment) <#1767 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONDSZJTM3KWZFQEPACIISTSCJ6THANCNFSM4DWRE5IA . Thankyou so much.... can you help me ..how to set the path. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1767 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONDSZN2BVYAHLNHJBV4U2TSCMLFXANCNFSM4DWRE5IA .

Thankyou

Hi
I am facing an issue while running the yarn start and after 94% it gives an error . Any suggestions. I tried to reinstall the watchman

Snip20200914_1

Was this page helpful?
0 / 5 - 0 ratings