1

I'm using MacOS Mojave 10.14.5. When I run 'npm run dev' command where the nuxt starter package is located, I have 'fsevents' error, and the server doesn't work.

I already reinstall node and npm several times, but it doesn't work.

Here's an error:

/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:28
return (new fsevents(path)).on('fsevent', callback).start();
          ^
TypeError: fsevents is not a constructor
    at createFSEventsInstance (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:28:11)
    at setFSEventsListener (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:82:16)
    at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:252:16)
    at FSWatcher.<anonymous> (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:386:25)
    at LOOP (fs.js:1570:14)
    at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt_test_b@1.0.0 dev: `nuxt`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nuxt_test_b@1.0.0 dev 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!     /Users/kimgyun/.npm/_logs/2019-06-06T02_11_18_374Z-debug.log

How can I run this nuxt.js server without this error?

GONG
  • 3,976
  • 1
  • 24
  • 27
nate
  • 13
  • 1
  • 5

1 Answers1

4

It's a problem with fs events, and a rather annoying one at that. Specifically this happens when you're using Node 12.

You'll need to install fsevents@1.2.9 explicitly:

npm i fsevents@1.2.9 -D

or

yarn add fsevents@1.2.9 -D

This should work for you at this point.

Ohgodwhy
  • 49,779
  • 11
  • 80
  • 110
  • Just here to add that this worked for me as well. I had a repository that had a sub-dependency on fsevents@1.2.4 and it failed to install from source correctly using node-gyp. Manually installing fsevents@1.2.9 as a devDependency fixed the issue – Asjas Jan 02 '20 at 10:34