The engine “node” is incompatible with this module. Expected version XXX

执行 “yarn install” 报如下错误,错误表示node版本不一致:

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

xxxxxxxxxx git config –global url.”https://”.insteadOf git://npm installshell

注意:错误报的是Node.js版本不一致,而不是npm版本不一致,所以网上有些建议更新npm的实际上是没用的。

方案1:

卸载旧版Node.js,去官网下载并重新安装指定版本区间的Node.js后重新执行命令成功: 在这里插入图片描述 忘记Node.js安装位置的可以执行where node进行查看: 在这里插入图片描述

方案2:

忽略错误后重新yarn install

 yarn config set ignore-engines true