简体   繁体   中英

Node uses 150% of CPU on sass compile

I found lots of issues with offered solutions on node using cpu but no one solved my problem - mostly it was said to install fsevents and rebuild, remove node modules and reinstall. Also was offered to add poll:false, but I'm not sure I have web-pack. I'm practicing sass so it's a very simple app having only sass installed as a node module, and the script is:

"scripts": {
        "compile:sass": "node-sass sass/main.scss css/style.css -w"
}

So all I use is live-server and npm run compile:sass.

Versions : node-sass: "^4.14.1", Node: "^14.15.0"

I tried to see what's going on with node cpu consumption when running other apps that do not include that script, and the consumption was adequate.

Besides all of that I tried to change versions of node-sass (to 4.13.1) and nodejs (to 14.15.4) and also I deleted the node-sass globally.

Does anyone know what can be the solution?

The problem was in live-server - not in nodejs or node-sass as I thought.

If I understand right, live-server watched node_modules folder which had node-sass watching as well, and that caused such CPU load.

Once node_modules will be ignored by live-server, the problem is solved.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM