13 thoughts on “Very high CPU usage with new watcher

  1. It doesn’t seem to lag so much if I explicitly install fsevents so chokidar uses it.
    Still, it’s about 150%% and doesn’t get lower.

  2. OK, let’s presume I did something stupid.
    Nuking node_modules/webpack and npm install fixed the problem.

    Still—I wonder if Watchpack (and Webpack) should now have fsevents as an optional dependency?
    Otherwise it just doesn’t get installed by default (even if it could be).
    Or is this not how NPM works?

  3. In case this helps someone else, I was able to fix high CPU usage by doing what gaearon suggested in a previous comment.
    I had restored a Time Machine backup from Laptop A, on which I previously ran npm install, to Laptop B.
    On Laptop B, deleting node_modules/ and running npm install brought CPU usage from ~45%% down to 0%%.

    OS X 10.11.3 (on both laptops).

  4. I just ran into this too. You don’t need to run npm install on your whole project again. Just npm install fsevents in the project directory.

  5. @gaearon I’m sorry for dusturbing. I’ve just found out the cause of my problem and it doesn’t relate to this topic. The reason it consumed so much CPU was in these lines:

    watchOptions: {
        aggregateTimeout: 300, // <---------
        poll: 1000, // <---------
        ignored: /node_modules/

    I haven’t even seen what they do in docs as the most of the config came from angular2-webpack-starter project. Commenting the lines solves the problem.

  6. In my experience, this CPU hogging happens every time I upgrade node.js to a new version, I need to reinstall fsevents (or just nuke the node_modules folder and reinstall)

  7. If you use yarn you can do yarn add fsevents --optional. This will allow you to save fsevents in package.json but it will not break builds on other platforms.

    Optional dependencies are just that: optional. If they fail to install, Yarn will still say the install process was successful.
    This is useful for dependencies that won’t necessarily work on every machine and you have a fallback plan in case they are not installed (e.g. Watchman).

  8. Deleting the entire node_modules folder and npm install fixed the problem for me. Just nuking the webpack folder did not do the trick.

Comments are closed.