> ## Content Index
> Fetch the complete content index at: https://til.codes/llms.txt
> Use this file to discover other available public pages before exploring further.

# Fix for 100% CPU usage by node.js
- URL: https://til.codes/fix-for-100-cpu-usage-by-nodejs/
- Published: 2018-03-17T18:09:54.000Z
- Updated: 2018-03-17T18:09:54.000Z
- Description: If you are on MacOs and you don't have installed fsevents, you might see a spike in CPU usage when running projects which watches the filesystem changes, especially projects like Webpack. To fix the issue, install fsevents or rebuild using fsevents.
- Author: Manu Ajith
- Tags: node, #Import 2024-07-13 21:01

I was seeing a really high spike in CPU usage while running projects which used node.js, in most cases the CPU usage was way above 100%.

This issue can be really intimidating when you have watchers which watch for file changes, like for eg: webpack.

As usual, my google-fu landed in a couple of Github issues where users mentioned the same problems.

### Whats the fix.?

TL;DR install/re-install fsevents

- Install `fsevents` if you are using MacOS and have not already installed it

```
npm install fsevents

```

- Rebuild if you had installed `fsevents` but recently upgraded node version.

```
npm rebuild fsevents

```

Hope this helps someone. :spock\_hands:

### References:

[https://github.com/nodejs/node/issues/6459](https://github.com/nodejs/node/issues/6459?ref=til.codes)  
[https://github.com/webpack/webpack/issues/701](https://github.com/webpack/webpack/issues/701?ref=til.codes)  
[https://github.com/webpack/webpack-dev-server/issues/172](https://github.com/webpack/webpack-dev-server/issues/172?ref=til.codes)  
[https://github.com/paulmillr/chokidar/issues/447](https://github.com/paulmillr/chokidar/issues/447?ref=til.codes)