我正在用typscript编写一个简单的Azure DevOps扩展,在package.json中安装必要的包时遇到了很多麻烦。nodejs 18.16.0 npm 9.51这是否意味着React 18.2不兼容azure-devops-ui 2.167.75需要React版本16.8.1才能成功构建?
如果你能帮忙的话
我在package.json文件中包含了错误输出和所有内容
package.json
{
"name": "single-select-control",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"azure-devops-extension-api": "^2.221.0",
"azure-devops-extension-sdk": "^3.1.2",
"azure-devops-extension-ui": "1.0.2",
"azure-devops-ui": "^2.167.75",
"bootstrap": "^5.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^1.1.5",
"react-select": "^5.7.3"
},
"description": "",
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@babel/preset-react": "^7.22.5",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"babel-loader": "^9.1.2",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.8.1",
"eslint": "^8.43.0",
"eslint-config-defaults": "^9.0.0",
"eslint-loader": "^4.0.0",
"eslint-plugin-react": "^7.25.3",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.3",
"prop-types": "^15.8.1",
"style-loader": "^3.3.3",
"tfx-cli": "^0.15.0",
"url-loader": "^4.1.1",
"vss-web-extension-sdk": "^5.141.0",
"webpack": "^5.88.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --mode=development --watch",
"start": "webpack-dev-server --open --mode=development",
"package": "tfx extension create --rev-version --manifest-globs vss-extension.json --no-prompt --json",
"build": "webpack --mode=production"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
字符串
运行npm install时的输出
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: single-select-control@0.1.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.1" from azure-devops-ui@2.167.75
npm ERR! node_modules/azure-devops-ui
npm ERR! azure-devops-ui@"^2.167.75" 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!
npm ERR! For a full report see:
npm ERR! C:\Users\z070187\AppData\Local\npm-cache\_logs\2023-07-03T23_58_46_212Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\z070187\AppData\Local\npm-cache\_logs\2023-07-03T23_58_46_212Z-debug-0.log
型
1条答案
按热度按时间mspsb9vt1#
@mangel你可以检查this tool,我以前没有用过它,我不确定它是否对你的情况有帮助。但是我建议你仔细检查最近添加的依赖项,这些依赖项可能已经开始导致这个错误,但是如果你没有意识到这一点。在开发环境中尝试以下操作:
npm audit fix
,这可能会修复一些依赖项,但这只是在它们过时的情况下。注意:在执行这些步骤之前,请确保您处于单独的开发环境中,以避免任何复杂情况,并删除
package-lock.json
文件和node_modules
文件夹