While staring React app using npm start this error occurred...
I tried below things:
remove node_module package and reinstall
use yarn instead npm
3.update fsevent library using npm
still getting this error
Note: If we create react app fresh/new yarn start will work, but we close the terminal and restart using same thing below error occurred
/Users/nannam/test-app-2/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/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:28:11) at setFSEventsListener (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:82:16) at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:252:16) at FSWatcher. (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:386:25) at LOOP (fs.js:1565:14) at process._tickCallback (internal/process/next_tick.js:61:11) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm audit fix --force
它在我的情况下有效
This is a well-documented issue on the react GitHub repo with a couple of options to try.
I solved my error by re-installing the fsevents npm i fsevents
, which worked
The @not-a-file gave will work only you can install the fsevents successfully。 but when I do that, I receive an error with this:
Error: EACCES: permission denied, mkdir '/Users/**/node_modules/jest-haste-map/node_modules/fsents/.node-gyp'
So ,I suggest you avoid this by use something like this:
sudo npm i fsevents --unsafe-perm=true --allow-root
And I also find this error may due to node version, when I use node 12,I can not install fsevents successfully , so I use nvm to modify my node version to v11.15.0
我解决了
sudo npm i fsevents --unsafe-perm
👍 Solved it using Yarn's selective dependency resolutions
"resolutions": {
"chokidar": "^3.3.1"
},
as some packages in my dependencies are still on older chokidar versions < 3
I also had the same issue though am using MacOS the issue is kind of bug. I solved this issue by repeatedly running the commands,
One time it did not worked but when I repeatedly cleaned the cache and after uninstalling npm, reinstalled npm, the error went off. Am using Angular 8 and this issue is common
对我来说,将 node 降级到 v11.15.0 解决了这个错误。
remove node_module
and package-lock.json
and use yarn
instead of npm
. This saved me hours.
I deleted the node modules package and reinstalled the node and then executed the node js commands. it worked fine for me.
Do these simple steps. Run the following
rm -rf node_modules/ package-lock.json
and then
npm i
This worked for me.
I FINALLY resolved the issue. The fsevent error occurred right after I installed bootstrap from my VS code terminal. I ended up using the react-bootstrap-github stylesheet code instead and put it in my index.html!
我解决了使用这个react-scripts": "2.1.8
改变我的“package.json react-scripts": "2.1.8
I had the same issue. I run the following command and it is working fine now, without using Yarn.
"npm audit fix"
I just solved this issue in node v11.15.0 my solution was: with my "react-scripts" version in "3.0.1" I just update it to "2.1.8" and run npm install
after. You can use this version or search for one that works for you. Another option is updating nodejs to the latest version, then remove modules and run npm install
.
Currently, we did not found any permanent resolve, but you just create that app again or use yarn
package manager to install all modules again in your react app then run yarn start
. that's how I solve my issue in react app.
运行后我能够让它工作: $sudo npm install npm@latest -g
I had this issue using the ng serve
command. I tried all of the above combinations and none of them seemed to fix this issue permanently. A simple quick fix / get around for me was to close and reopen the terminal.
I had this error TypeError: fsevents is not a constructor
and tried all answers (remove node_modules, uninstalling/installing fsevents, sudo npm cache clean --force, sudo npm install/uninstall) listed; but nothing resolved it. For some reason, fsevents is breaking for node version >v10.x.
Regenerating lockfile resolved this issue
npm i --package-lock-only
运行这个命令
npm install latest-version
Run: npm audit fix --force
Then, try again.
This often happens due to the continuous update to react and npm-packages.
Try to remove your node_modules
npm uninstall
delete your yarn.lock this will save tons of time and if you are using npm instead if yarn always updated.
run yarn install
After trying "npm audit fix --force" did not work, I tried:
worked for me
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.