无法 运行 NPM 安装,因为它是 'unable to resolve dependency tree'
Cannot run NPM install because it's 'unable to resolve dependency tree'
我的 node_modules 有一些问题,所以我删除了 node_modules 和 运行 npm install
。男孩是个错误。我的项目完全搞砸了。当我 运行 npm install
npm 它发回这个:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"15.3.0 - 16.x" from react-vis@1.11.7
npm ERR! node_modules/react-vis
npm ERR! react-vis@"^1.11.7" 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.
npm ERR!
npm ERR! See /Users/Cole/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Cole/.npm/_logs/2021-05-26T10_34_07_786Z-debug.log
有人请帮助我!
编辑:这是我的 package.json。
{
"name": "project",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.1",
"npm": "^7.14.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-vis": "^1.11.7",
"redux": "^4.1.0",
"web-vitals": "^1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
不太确定我的所作所为如此有害,但这是一次痛苦的经历。
当运行ning npm audit
时显示有87个漏洞。
运行 npm audit fix
和 npm audit fix --force
没有解决任何问题。
有没有办法刷新所有node_modules?返回第一步并再次重新安装所有依赖项?
似乎 react-vis
具有 react@"15.3.0 - 16.x"
的对等依赖性。由于您有 react@17.0.2,它会抱怨。尝试改变
"react": "^17.0.2",
"react-dom": "^17.0.2",
到
"react": "^16.14.0",
"react-dom": "^16.14.0",
我的 node_modules 有一些问题,所以我删除了 node_modules 和 运行 npm install
。男孩是个错误。我的项目完全搞砸了。当我 运行 npm install
npm 它发回这个:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"15.3.0 - 16.x" from react-vis@1.11.7
npm ERR! node_modules/react-vis
npm ERR! react-vis@"^1.11.7" 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.
npm ERR!
npm ERR! See /Users/Cole/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Cole/.npm/_logs/2021-05-26T10_34_07_786Z-debug.log
有人请帮助我!
编辑:这是我的 package.json。
{
"name": "project",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.1",
"npm": "^7.14.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-vis": "^1.11.7",
"redux": "^4.1.0",
"web-vitals": "^1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
不太确定我的所作所为如此有害,但这是一次痛苦的经历。
当运行ning npm audit
时显示有87个漏洞。
运行 npm audit fix
和 npm audit fix --force
没有解决任何问题。
有没有办法刷新所有node_modules?返回第一步并再次重新安装所有依赖项?
似乎 react-vis
具有 react@"15.3.0 - 16.x"
的对等依赖性。由于您有 react@17.0.2,它会抱怨。尝试改变
"react": "^17.0.2",
"react-dom": "^17.0.2",
到
"react": "^16.14.0",
"react-dom": "^16.14.0",