启动开发服务器...
/Users/puneetrangrass/Documents/react/react-practice/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/puneetrangrass/Documents/react/react-practice/node_modules/chokidar/lib/fsevents-handler.js:28:11)
at setFSEventsListener (/Users/puneetrangrass/Documents/react/react-practice/node_modules/chokidar/lib/fsevents-handler.js:82:16)
at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/puneetrangrass/Documents/react/react-practice/node_modules/chokidar/lib/fsevents-handler.js:252:16)
at FSWatcher. (/Users/puneetrangrass/Documents/react/react-practice/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! react-practice@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-practice@0.1.0 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! /Users/puneetrangrass/.npm/_logs/2019-07-13T05_06_50_503Z-debug.log
puneets-MacBook-Pro:react-practice puneetrangrass$ node --v
node: bad option: --v
puneets-MacBook-Pro:react-practice puneetrangrass$ node -v
v10.16.0
puneets-MacBook-Pro:react-practice puneetrangrass$
在我的机器上
节点:v10.16.0 npm:6.9.0
在React应用中执行“ npm start”时。我该如何解决该问题?
答案 0 :(得分:0)
如果仍有问题,请执行以下操作。
node_modules
文件夹以及所有锁定文件(package.lock
)和package-lock.json
。基本上,您的项目文件夹应仅具有package.json和src文件夹(可以具有.git和Readme.md,但此处与它们无关)。 rm -rf node_modules
rm -rf package-lock.json
如果您已经有npm,那么就像
npm install -g yarn
否则,请使用此链接来安装Eclipse Project Configuration Snapshot。
yarn install
npm start
以启动您的项目。然后,您应该不会再看到这些错误。如果仍然看到它们,请运行npm cache clean --force
并重新启动。当前您遇到的问题主要是由于chokidar。
我用这个Yarn来解决github thread给出的问题。