[英]Error npm install - unable to resolve dependency tree
After npm install, Error report: npm安装后报错:
While resolving: reactjs-simple-boilerplate@1.0.0解析时:reactjs-simple-boilerplate@1.0.0
Found: webpack@4.46.0找到:webpack@4.46.0
node_modules/webpack节点模块/webpack
dev webpack@"^4.41.2" from the root project从根项目开发 webpack@"^4.41.2"
Could not resolve dependency:无法解决依赖关系:
peer webpack@"^3.1.0" from extract-text-webpack-plugin@3.0.2来自 extract-text-webpack-plugin@3.0.2 的 peer webpack@"^3.1.0"
node_modules/extract-text-webpack-plugin node_modules/extract-text-webpack-插件
peer extract-text-webpack-plugin@">=0.3.8" from bootstrap-webpack@0.0.5来自 bootstrap-webpack@0.0.5 的 peer extract-text-webpack-plugin@">=0.3.8"
node_modules/bootstrap-webpack node_modules/bootstrap-webpack
bootstrap-webpack@"0.0.5" from the root project来自根项目的 bootstrap-webpack@"0.0.5"
enter image description here在此处输入图像描述
Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.修复上游依赖冲突,或使用 --force 或 --legacy-peer-deps 重试此命令以接受不正确(且可能损坏)的依赖解析。
Raw JSON explanation object:原始 JSON 解释 object:
{
"code": "ERESOLVE",
"current": {
"name": "webpack",
"version": "4.46.0",
"whileInstalling": {
"name": "reactjs-simple-boilerplate",
"version": "1.0.0",
"path": "/Users/mk/Kr/kr-application-bd786050/kr-site"
},
"location": "node_modules/webpack",
"isWorkspace": false,
"dependents": [
{
"type": "dev",
"name": "webpack",
"spec": "^4.41.2",
"from": {
"location": "/Users/MK/Kr/kr-application-bd786050/kr-site"
}
}
]
},
"currentEdge": {
"type": "dev",
"name": "webpack",
"spec": "^4.41.2",
"from": {
"location": "/Users/MK/Kr/kr-application-bd786050/kr-site"
}
},
"edge": {
"type": "peer",
"name": "webpack",
"spec": "^3.1.0",
"error": "INVALID",
"from": {
"name": "extract-text-webpack-plugin",
"version": "3.0.2",
"whileInstalling": {
"name": "reactjs-simple-boilerplate",
"version": "1.0.0",
"path": "/Users/MK/Kr/kr-application-bd786050/kr-site"
},
"location": "node_modules/extract-text-webpack-plugin",
"isWorkspace": false,
"dependents": [
{
"type": "peer",
"name": "extract-text-webpack-plugin",
"spec": ">=0.3.8",
"from": {
"name": "bootstrap-webpack",
"version": "0.0.5",
"whileInstalling": {
"name": "reactjs-simple-boilerplate",
"version": "1.0.0",
"path": "/Users/MK/Kr/kr-application-bd786050/kr-site"
},
"location": "node_modules/bootstrap-webpack",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "bootstrap-webpack",
"spec": "0.0.5",
"from": {
"location": "/Users/MK/Kr/kr-application-bd786050/kr-site"
}
}
]
}
}
]
}
},
"strictPeerDeps": false,
"force": false
}
Firstly try running webpack-cli init
/ webpack init
and see if that fixes it.首先尝试运行
webpack-cli init
/ webpack init
看看是否修复了它。
Next try:下一步尝试:
yarn remove extract-text-webpack-plugin
yarn add --dev extract-text-webpack-plugin@next
If neither work, then sometimes this can be a problem if the required package only works with a specific version of node/npm.如果两者都不起作用,那么如果所需的 package 仅适用于特定版本的节点/npm,有时这可能会成为问题。 If you don't already you should try using
nvm
for managing different versions of node which you can do by writing nvm use <version number>
in your terminal.如果你还没有,你应该尝试使用
nvm
来管理不同版本的节点,你可以通过在终端中编写nvm use <version number>
来实现。
Research your specific package that's causing dependency issues and see if it requires using a specific node.js version.研究导致依赖性问题的特定 package,看看它是否需要使用特定的 node.js 版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.