1

I've created a new project through create-react-app. After the project successfully created, I'm trying to start the project by hitting command yarn start but it throws me an unhandled error.

Anyone has a good solution to this problem.

Starting the development server...

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

Error: watch /home/sagar/workspace/code-splitting/public ENOSPC
    at _errnoException (util.js:1022:11)
    at FSWatcher.start (fs.js:1382:19)
    at Object.fs.watch (fs.js:1408:11)
    at createFsWatchInstance (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:232:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:414:19)
    at FSWatcher.<anonymous> (/home/sagar/w    Starting the development server...

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

Error: watch /home/sagar/workspace/code-splitting/public ENOSPC
    at _errnoException (util.js:1022:11)
    at FSWatcher.start (fs.js:1382:19)
    at Object.fs.watch (fs.js:1408:11)
    at createFsWatchInstance (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:232:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:414:19)
    at FSWatcher.<anonymous> (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:462:19)
    at FSWatcher.<anonymous> (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:467:16)
    at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.orkspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:462:19)
    at FSWatcher.<anonymous> (/home/sagar/workspace/code-splitting/node_modules/chokidar/lib/nodefs-handler.js:467:16)
    at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
tk421
  • 5,775
  • 6
  • 23
  • 34
Sagar
  • 4,473
  • 3
  • 32
  • 37
  • Possible duplicate of [Node.js – events js 72 throw er unhandled 'error' event](https://stackoverflow.com/questions/22960703/node-js-events-js-72-throw-er-unhandled-error-event) – Bhojendra Rauniyar Oct 07 '18 at 05:43

5 Answers5

1

To resolve the problem you can follow this steps.

First, reinstall node_modules:

rm -rf node_modules/ && npm i

Then, start the project:

npm start 

or

yarn start
Soroush Chehresa
  • 5,490
  • 1
  • 14
  • 29
0

Reinstalling the dependencies is the solution.

Delete the node_modules directory

and then:

yarn install
0

Reinstall node modules using npm install and do

npx create-react-app my-app cd my-app npm start

Nikhil Pathania
  • 812
  • 6
  • 19
0

credit: @robininfo-edsx "The current error is a ENOSPC (Not enough space) It's not directly related to permission but normally to disk usage and when you hit the limit of file you can watch. As root the limit of watch is probably bigger than a normal use,that's why sudo solve the problem however run an application as root is not desirable. Try to increase the limit of watchable files https://stackoverflow.com/questions/22475849/node-js-error-enospc/32600959#32600959"

jsibs
  • 666
  • 2
  • 7
  • 25
-1

Found solution on https://github.com/facebook/create-react-app/issues/3486#issuecomment-346485194

sudo yarn start
Sagar
  • 4,473
  • 3
  • 32
  • 37