我升级到了新的节点版本(v16.16.0)和npm版本(8.11.0)。我之前已经删除了节点模块和package-lock.json
npm install
。但是当我尝试npm install
时出现此错误:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/stylelint
npm ERR! stylelint@"^13.7.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer stylelint@"^8.0.0" from [email protected]
npm ERR! node_modules/stylelint-config-standard
npm ERR! stylelint-config-standard@"^17.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution
这是
package.json
中的依赖版本:
"stylelint-webpack-plugin": "^0.10.5",
"stylelint": "^13.7.2",
我尝试将其更改为
17.0.0
,但以下仍然不起作用。
"stylelint-webpack-plugin": "^0.10.5",
"stylelint": "^17.0.0",
npm 的第 8 版将在不满足对等依赖项时发出警告,例如未满足在 stylelint-config-standard 中定义为对等依赖项的 stylelint 版本。
您应该一起更新所有与 stylelint 相关的依赖项:
npm i -D stylelint@latest stylelint-config-standard@latest stylelint-webpack-plugin@latest