client
中的 create-react-app 站点。它使用打字稿。
"devDependencies": {
"typescript": "^4.1.3",
.....
React 应用有自己的 package-json
和 node_modules
My-Project
├── package.json
├── node_modules
├── ....
├──client
├── package.json
├── node_modules
├── ....
根文件夹有它自己的 package.json
和 node_modules
。
有一个使用 Typescript 作为开发依赖项的库。
"node_modules/typechain/node_modules/ts-essentials": {
"version": "6.0.7",
"resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz",
"integrity": "sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==",
"dev": true,
"peerDependencies": {
"typescript": ">=3.7.0"
}
},
npm ERR! Found: typescript@4.2.3
npm ERR! node_modules/typescript
npm ERR! dev typescript@"^4.1.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1" from react-scripts@4.0.1
结果如上。
有没有办法不用 --force
或 --legacy-peer-deps
来解决这个问题?