反应/打字稿无法解决依赖

时间:2021-03-10 00:27:33

标签: node.js reactjs typescript npm

client 中的 create-react-app 站点。它使用打字稿。

"devDependencies": {
  "typescript": "^4.1.3",
  .....

React 应用有自己的 package-jsonnode_modules

My-Project
├── package.json
├── node_modules
├── ....
├──client
   ├── package.json
   ├── node_modules
   ├── ....

根文件夹有它自己的 package.jsonnode_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 来解决这个问题?

0 个答案:

没有答案