Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled 'error' event with json-server --watch #361

Closed
theshem opened this issue Sep 18, 2016 · 7 comments
Closed

Unhandled 'error' event with json-server --watch #361

theshem opened this issue Sep 18, 2016 · 7 comments

Comments

@theshem
Copy link

theshem commented Sep 18, 2016

I'm having an issue with --watch option, it ends up with an Unhandled 'error' event error and it stops. Any ideas?

json-server -w db.json

I got:

{^_^}/ hi!

Loading db.json
Done

Resources
http://localhost:3000/users

Home
http://localhost:3000

Type s + enter at any time to create a snapshot of the database
Watching...

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

Error: watch node_modules/custom-event/.travis.yml ENOSPC
at exports._errnoException (util.js:1036:11)
at FSWatcher.start (fs.js:1429:19)
at Object.fs.watch (fs.js:1456:11)
at createFsWatchInstance (/home/hashem/.nvm/versions/node/v6.6.0/lib/node_modules/json-server/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/hashem/.nvm/versions/node/v6.6.0/lib/node_modules/json-server/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/hashem/.nvm/versions/node/v6.6.0/lib/node_modules/json-server/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleFile (/home/hashem/.nvm/versions/node/v6.6.0/lib/node_modules/json-server/node_modules/chokidar/lib/nodefs-handler.js:255:21)
at FSWatcher. (/home/hashem/.nvm/versions/node/v6.6.0/lib/node_modules/json-server/node_modules/chokidar/lib/nodefs-handler.js:473:21)
at FSReqWrap.oncomplete (fs.js:123:15)

@zarathon
Copy link

i have same problem here... =|

@zarathon
Copy link

If you using UBUNTU or some Debian distribution, try this in terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

@fabiomirandaa
Copy link

Thank you @zarathon 😄

@olivierthereaux
Copy link

Other than the workaround proposed by @zarathon - I've found that creating a directory and storing db.json there rather than in the home directory for that user works.

@typicode
Copy link
Owner

typicode commented Oct 6, 2016

Thanks @zarathon, @olivierthereaux
I'll see if it's possible to better configure chokidar or use another approach

@typicode
Copy link
Owner

Should be good in v0.9.0

@dkhandal
Copy link

dkhandal commented Jul 2, 2018

killall node
execute this command first then start your server again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants