假设我有一个package.json
像这样:
{
"name": "my-app",
"version": "0.1.0",
"dependencies": {
"@aws-sdk/client-s3": "^3.21.0",
"@testing-library/react": "^11.2.5",
"axios": "^0.22.0",
"credit-card-type": "^8.3.0",
"csstype": "^3.0.8",
"dayjs": "^1.10.4",
"lodash": "^4.17.20",
"mathjax-full": "^3.2.0",
"mathjax-react": "^1.0.6",
"react": "^17.0.2",
},
"proxy": "http://localhost:5000",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "jest",
"eject": "react-scripts eject",
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
问题是依赖mathjax-react
& mathjax-full
need react@"^15.0.0 || ^16.0.0"
。我已经测试过npm i --force
and npm i --legacy-peer-deps
这一切似乎与我的反应版本一起工作得很好[email protected] /cdn-cgi/l/email-protection
.
我不想跑步npm i --force
and npm i --legacy-peer-deps
每次我需要安装依赖项时,所以我一直在寻找一种方法来自动执行此操作mathjax-react
& mathjax-full
每当我跑步时npm i
。我尝试查看.npmrc
docs https://docs.npmjs.com/cli/v7/configuring-npm/npmrc和这个参考 https://stackabuse.com/the-ultimate-guide-to-configuring-npm/,但找不到办法做到这一点。对此可能有什么解决方案?有本土人吗npm
解决这个问题?或者我是否必须编写一个脚本来读取我的package.json
并运行npm install
仅针对每个依赖项?
我的理由是,如果我需要安装一些其他有冲突的依赖项,我永远不会收到警告。