我在为Node.js项目运行npm install时遇到了一个问题。似乎有一个与对等依赖的冲突,我无法解决它。我使用的是Node.js版本12.22.9和npm版本9.8.1。该项目使用React和TypeScript构建。当我运行npm install或invenio-cli install时,我得到以下错误:
npm ERR! ERESOLVE could not resolve
npm ERR! While resolving: @typescript-eslint/eslint-plugin@2.34.0
npm ERR! Found: eslint@7.32.0
npm ERR! Conflicting peer dependency: eslint@6.8.0
字符串
项目结构:
- Project root
- package.json
- node_modules
- ... (other project files)
型
Package.json(项目级):
{
"name": "hmm",
"version": "1.0.0",
"description": "Welcome to your InvenioILS instance.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "npm install --force"
},
"author": "",
"license": "ISC",
"dependencies": {
"@ckeditor/ckeditor5-react": "2.1.0",
"@craco/craco": "5.9.0",
"@emotion/core": "^11.0.0",
"@emotion/react": "11.7.0",
"@hookform/error-message": "1.1.0",
"@hookform/resolvers": "1.1.0",
"@testing-library/jest-dom": "5.14.1",
"@testing-library/react": "12.0.0",
"@testing-library/user-event": "13.1.9",
"@types/classnames": "2.3.1",
"@types/lodash": "4.14.173",
"@types/react": "17.0.37",
"@types/react-dom": "17.0.11",
"@typescript-eslint/eslint-plugin": "2.34.0",
"@typescript-eslint/parser": "2.34.0",
"axios": "^0.21.4",
"classnames": "2.3.1",
"eslint-plugin-flowtype": "5.8.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-react": "7.26.1",
"eslint-plugin-react-hooks": "4.3.0",
"lodash": "4.17.21",
"query-string": "7.0.1",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-invenio-forms": "2.4.0",
"react-select": "^5.0.0",
"react-toastify": "8.0.3",
"react-transition-group": "4.4.2",
"recoil": "0.3.1",
"sweetalert2": "11.1.0",
"yup": "0.32.11"
},
"devDependencies": {
"eslint": "7.32.0",
"@typescript-eslint/parser": "2.34.0",
"eslint-config-react-app": "5.2.1"
},
"resolutions": {
"eslint": "^7.32.0",
"eslint-config-react-app": "^5.2.1",
"@typescript-eslint/parser": "^2.34.0"
}
}
型
电流输出:我收到上面提到的错误消息。
预期输出:我希望npm install
运行时没有任何冲突,并成功安装所有依赖项。
其他信息:
我尝试运行npm install --force
,但它没有解决问题。我也试过运行npm install --legacy-peer-deps
,但它也不起作用。我在这篇文章中分享了npm list
、npm outdated
和npm list -g --depth=0
的输出,以提供更多关于我的项目设置的上下文。Node.js版本:12.22.9 npm版本:9.8.1
npm list的输出:
algorithmx@Torime:~/hmm$ npm list
hmm@1.0.0 \\wsl.localhost\Ubuntu\home\algorithmx\hmm
+-- @ckeditor/ckeditor5-react@2.1.0
+-- @craco/craco@5.9.0
+-- @emotion/core@11.0.0
+-- @emotion/react@11.7.0
+-- @hookform/error-message@1.1.0
+-- @hookform/resolvers@1.1.0
+-- @testing-library/jest-dom@5.14.1
+-- @testing-library/react@12.0.0
+-- @testing-library/user-event@13.1.9
+-- @types/classnames@2.3.1
+-- @types/lodash@4.14.173
+-- @types/react-dom@17.0.11
+-- @types/react@17.0.37
+-- @typescript-eslint/eslint-plugin@2.34.0
+-- @typescript-eslint/parser@2.34.0
+-- axios@0.21.4
+-- classnames@2.3.1
+-- eslint-config-react-app@5.2.1
+-- eslint-plugin-flowtype@5.8.0
+-- eslint-plugin-import@2.25.3
+-- eslint-plugin-jsx-a11y@6.4.1
+-- eslint-plugin-react-hooks@4.3.0
+-- eslint-plugin-react@7.26.1
+-- eslint@7.32.0
+-- lodash@4.17.21
+-- query-string@7.0.1
+-- react-dom@16.14.0
+-- react-invenio-forms@2.4.0
+-- react-select@5.7.4
+-- react-toastify@8.0.3
+-- react-transition-group@4.4.2
+-- react@16.14.0
+-- recoil@0.3.1
+-- sweetalert2@11.1.0
`-- yup@0.32.11
型npm outdated
的输出:
algorithmx@Torime:~/hmm$ npm outdated
Package Current Wanted Latest Location
Depended by
@ckeditor/ckeditor5-react 2.1.0 2.1.0 6.1.0 node_modules/@ckeditor/ckeditor5-react hmm
@craco/craco 5.9.0 5.9.0 7.1.0 node_modules/@craco/craco
hmm
@emotion/react 11.7.0 11.7.0 11.11.1 node_modules/@emotion/react
hmm
@hookform/error-message 1.1.0 1.1.0 2.0.1 node_modules/@hookform/error-message
hmm
@hookform/resolvers 1.1.0 1.1.0 3.1.1 node_modules/@hookform/resolvers
hmm
@testing-library/jest-dom 5.14.1 5.14.1 5.17.0 node_modules/@testing-library/jest-dom hmm
@testing-library/react 12.0.0 12.0.0 14.0.0 node_modules/@testing-library/react
hmm
@testing-library/user-event 13.1.9 13.1.9 14.4.3 node_modules/@testing-library/user-event hmm
@types/lodash 4.14.173 4.14.173 4.14.196 node_modules/@types/lodash
hmm
@types/react 17.0.37 17.0.37 18.2.17 node_modules/@types/react
hmm
@types/react-dom 17.0.11 17.0.11 18.2.7 node_modules/@types/react-dom
hmm
@typescript-eslint/eslint-plugin 2.34.0 2.34.0 6.2.0 node_modules/@typescript-eslint/eslint-plugin hmm
@typescript-eslint/parser 2.34.0 2.34.0 6.2.0 node_modules/@typescript-eslint/parser hmm
axios 0.21.4 0.21.4 1.4.0 node_modules/axios
hmm
classnames 2.3.1 2.3.1 2.3.2 node_modules/classnames
hmm
eslint 7.32.0 7.32.0 8.46.0 node_modules/eslint
hmm
eslint-config-react-app 5.2.1 5.2.1 7.0.1 node_modules/eslint-config-react-app
hmm
eslint-plugin-flowtype 5.8.0 5.8.0 8.0.3 node_modules/eslint-plugin-flowtype
hmm
eslint-plugin-import 2.25.3 2.25.3 2.28.0 node_modules/eslint-plugin-import
hmm
eslint-plugin-jsx-a11y 6.4.1 6.4.1 6.7.1 node_modules/eslint-plugin-jsx-a11y
hmm
eslint-plugin-react 7.26.1 7.26.1 7.33.1 node_modules/eslint-plugin-react
hmm
eslint-plugin-react-hooks 4.3.0 4.3.0 4.6.0 node_modules/eslint-plugin-react-hooks hmm
query-string 7.0.1 7.0.1 8.1.0 node_modules/query-string
hmm
react 16.14.0 16.14.0 18.2.0 node_modules/react
hmm
react-dom 16.14.0 16.14.0 18.2.0 node_modules/react-dom
hmm
react-toastify 8.0.3 8.0.3 9.1.3 node_modules/react-toastify
hmm
react-transition-group 4.4.2 4.4.2 4.4.5 node_modules/react-transition-group
hmm
recoil 0.3.1 0.3.1 0.7.7 node_modules/recoil
hmm
sweetalert2 11.1.0 11.1.0 11.7.20 node_modules/sweetalert2
hmm
yup 0.32.11 0.32.11 1.2.0 node_modules/yup
hmm
型npm list -g --depth=0
的输出:
algorithmx@Torime:~/hmm$ npm list -g --depth=0
C:\Users\Sammie\AppData\Roaming\npm
+-- @exlibris/exl-cloudapp-cli@1.4.7
+-- node-sass@
`-- npm@9.8.1
型
任何帮助解决这一冲突与对等依赖将不胜感激!先谢谢你了。
1条答案
按热度按时间sxpgvts31#
当前版本的InvenioILS仍然使用
NodeJS v14
,它随npm v6
一起提供。请使用这些版本重试。