简体   繁体   中英

Create-react-app failing with error: node incompatible with css-loader

I'm simply trying to create a react app with the command npx create-react-app my-app but get this error:

css-loader@1.0.0: The engine "node" is incompatible with this module. Expected version ">= 6.9.0 <7.0.0 || >= 8.9.0". Got "8.5.0"

I've tried updating node but it seems to not work, checking the version it says 8.5.0 just like in the error. Even restarted my computer as a last option but that also didn't help..

Is there anything else I could try? Any suggestions are welcome.

I had the same thing and spent few hours trying to figure it out. I think it was the webpack. Finally, I ended updating the node.

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Finally realised the problem was my old version of node, I had nvm installed and had to update which node version I'm using with nvm use node .

Update:

I had to use that command every time I started a new terminal session. Also had problems when some other packages were picking up the wrong node version for some reason.

That can be fixed with the command nvm alias default 10.11.0 , or which ever version you want to use.

I had the same problem, Als tried some stuff and after updating the lates version of node with nvm it worked. I got it from this website: https://bytearcher.com/articles/ways-to-get-the-latest-node.js-version-on-a-mac/

nvm install node --reinstall-packages-from=node

I can confirm that

nvm install node --reinstall-packages-from=node

worked well 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.

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