Nuxt.js:fsevents不是构造函数

时间:2019-06-06 02:27:15

标签: vue.js nuxt.js nuxt fsevents

我正在使用MacOS Mojave 10.14.5。当我在nuxt入门包所在的位置运行“ npm run dev”命令时,出现“ fsevents”错误,并且服务器无法正常工作。

我已经多次重新安装了node和npm,但是它不起作用。

这是一个错误:

/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

如何在没有此错误的情况下运行此nuxt.js服务器?

1 个答案:

答案 0 :(得分:0)

这是fs事件的问题,对此相当烦人。具体来说,这是在使用节点12时发生的。

您需要明确安装fsevents@1.2.9:

npm i fsevents@1.2.9 -D

yarn add fsevents@1.2.9 -D

这应该适合您。