我是React和WebPack的新手,实际上没有遇到过这样的问题。我试着设置Webpack,一切都很好。但是在开发过程中安装了一些包后,我开始出现这样的错误。我试着使用--legacy-peer-deps,但它并不能帮助我解决这些问题。如果你知道需要更改或更新哪些包以及如何修复它,提前感谢你!
While resolving: extract-text-webpack-plugin@3.0.2
npm ERR! Found: webpack@5.74.0
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^5.74.0" from the root project
npm ERR! peer webpack@">=4.43.0 <6.0.0" from @pmmmwh/react-refresh-webpack-plugin@0.5.8
npm ERR! node_modules/@pmmmwh/react-refresh-webpack-plugin
npm ERR! @pmmmwh/react-refresh-webpack-plugin@"^0.5.3" from @storybook/react@6.5.12
npm ERR! node_modules/@storybook/react
npm ERR! dev @storybook/react@"^6.5.12" from the root project
npm ERR! 25 more (@storybook/builder-webpack5, @storybook/core, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^3.1.0" from extract-text-webpack-plugin@3.0.2
npm ERR! node_modules/extract-text-webpack-plugin
npm ERR! dev extract-text-webpack-plugin@"^3.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@3.12.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^3.1.0" from extract-text-webpack-plugin@3.0.2
npm ERR! node_modules/extract-text-webpack-plugin
npm ERR! dev extract-text-webpack-plugin@"^3.0.2" 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 /home/user/.npm/eresolve-report.txt for a full report.
我的package.json在下面
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/preset-env": "^7.19.1",
"@babel/preset-typescript": "^7.18.6",
"@marshallofsound/webpack-asset-relocator-loader": "^0.5.0",
"@storybook/addon-actions": "^6.5.12",
"@storybook/addon-essentials": "^6.5.12",
"@storybook/addon-interactions": "^6.5.12",
"@storybook/addon-links": "^6.5.12",
"@storybook/builder-webpack5": "^6.5.12",
"@storybook/manager-webpack5": "^6.5.12",
"@storybook/preset-scss": "^1.0.3",
"@storybook/react": "^6.5.12",
"@storybook/testing-library": "^0.0.13",
"@testing-library/dom": "^8.18.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "12",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.0.2",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.2",
"@types/react-transition-group": "^4.4.5",
"@types/webpack-env": "^1.16.0",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^29.0.3",
"babel-loader": "^8.2.5",
"cross-env": "^7.0.3",
"css-loader": "^5.2.4",
"cz-conventional-changelog": "3.3.0",
"eslint": "^7.22.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.31.8",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^6.2.4",
"html-webpack-plugin": "^5.3.1",
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"less": "^4.1.1",
"less-loader": "8.1.1",
"mini-css-extract-plugin": "^1.5.0",
"react-hot-loader": "^4.13.0",
"react-test-renderer": "^18.2.0",
"resolve-url-loader": "2.3.1",
"sass": "^1.54.9",
"sass-loader": "^13.0.2",
"style-loader": "^2.0.0",
"ts-jest": "^29.0.1",
"ts-loader": "^9.1.0",
"typescript": "^4.8.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.6.0",
"webpack-dev-server": "^3.11.2"
},
"dependencies": {
"@hot-loader/react-dom": "^17.0.1",
"@types/node-sass": "^4.11.3",
"adjust-sourcemap-loader": "1.2.0",
"axios": "^0.27.2",
"classnames": "^2.3.2",
"css-modules-typescript-loader": "^4.0.1",
"eslint-plugin-padding": "^0.0.4",
"image-webpack-loader": "^8.1.0",
"node-sass": "^7.0.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-transition-group": "^4.4.5",
"ts-node": "^10.9.1",
"typescript-css-modules": "^1.0.4"
},
3条答案
按热度按时间soat7uwm1#
尝试运行
npm install --legacy-peer-deps
0dxa2lsx2#
您的节点版本似乎与项目需求恩怨。请先从您的计算机解除安装节点:from this link并从此处安装最新版本的节点:node installation
希望能成功谢谢
cwxwcias3#
尝试使用nvm降级节点版本