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

create-react-app新建項目時遇到的問題:

error eslint@6.1.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.12.0". 
Got "10.10.0"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.複製代碼

問題的緣由是node版本不兼容致使的,須要升級node版本,也能夠不升級用npx命令解決:node

用npx命令解決的方法:react

$ npx create-react-app demo-app --use-npm複製代碼

升級node版本(Mac):

一、查看本機node版本:npm

$ node -v複製代碼

二、清除node的cachebash

$ sudo npm cache clean -f複製代碼

三、安裝 n 工具,n工具是用來管理node.js版本的
app

$ sudo npm install -g n複製代碼

四、安裝最新版的node工具

$ sudo n stable複製代碼

五、更新npm版本this

$ sudo npm install npm@latest -g複製代碼

六、而後查看本機的node版本和npm版本spa

$ node -v
$ npm -v複製代碼


七、建立react新項目:eslint

$ create-react-app demo-app複製代碼
相關文章
相關標籤/搜索