error eslint@5.12.0: The engine "node" is incompatible with this module.


初始化 react項目時報錯:

error eslint@5.12.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "8.9.4"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

這是node版本不兼容導致的,升級node版本可以解決,不升級也可以解決,用下面的命令:

npx create-react-app my-app  --use-npm

  

官方issues:https://github.com/facebook/create-react-app/issues/5714 和 https://github.com/facebook/create-react-app/issues/3974

問題:

Guys, a few days ago, I installed `yarn` on my Mac just because it's necessary for a project where I'm involved.

My problem is that, now, when I create a new app with `CRA`, it's going to use `yarn` instead of `npm`. And, to be honest, I prefer `npm`.

Is there a way to force to use `npm` instead of `yarn`?
Or should I wait until finish the initial setup, then remove the `yarn.lock` file, the `node_modules` folder and then run `npm i`?

答案:

You can run CRA with `--use-npm` flag to force it to use npm.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM