【发布时间】:2022-04-03 00:43:00
【问题描述】:
我正在学习电子商务教程,但与讲师不同的是,我无法安装 react-paypal-button-v2。
我的错误日志是
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: frontend@0.1.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR! react@"^17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.6 || 15.x.x || 16.x.x" from react-paypal-button-v2@2.6.2
npm ERR! node_modules/react-paypal-button-v2
npm ERR! react-paypal-button-v2@"*" 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 文件:
{
"name": "frontend",
"proxy": "http://localhost:8000",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"dotenv": "^8.2.0",
"moment": "^2.29.1",
"react": "^17.0.1",
"react-bootstrap": "^1.4.3",
"react-dom": "^17.0.1",
"react-redux": "^7.2.2",
"react-router-bootstrap": "^0.25.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0",
"web-vitals": "^0.2.4"
},
"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"
]
}
}
我很困惑,因为我的依赖树与讲师完全相同,唯一的区别是我安装了 moment 和 dotenv,并且他在 PC 上运行而我在 Mac 上运行,但他安装它没有问题。
教程是最新的(不到一个月的时间),他的 package.json 中的版本与我的基本相同。
我发现此打开 issue,但开发人员尚未解决此问题。
我很想知道如何解决这个问题并继续进行下去,我相信这也将有助于我将来如何对这些错误进行排序。
谢谢!
【问题讨论】:
标签: reactjs npm paypal dependencies