我试图使用tsc
运行我的typescript项目,但我得到这个错误:
Found 181 errors in 4 files.
Errors Files
1 node_modules/@types/eslint-scope/node_modules/@types/eslint/helpers.d.ts:1
1 node_modules/@types/eslint/helpers.d.ts:1
176 node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3089
3 node_modules/@types/react/index.d.ts:2970
我试着像这样更新其中一个模块,但它不起作用:
npm install --save @types/eslint-scope
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project@1.4.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.13.1" from @design-systems/theme@3.7.0
npm ERR! node_modules/@design-systems/theme
npm ERR! peer @design-systems/theme@"^3.0.0" from @appfabric/providers@2.2.46
npm ERR! node_modules/@appfabric/providers
npm ERR! @appfabric/providers@"2.2.46" 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! /Users/abell5/.npm/_logs/2023-06-23T21_41_25_807Z-eresolve-report.txt
这也不起作用:
% npm i npm@latest
...
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! zlib: incorrect data check
有什么想法吗?
1条答案
按热度按时间xwmevbvl1#
在最新版本的node中显然有一个bug,请参阅Zlib error when attempting to run npm install or yarn。
你需要做降级纱和重新安装 typescript
确保安装了节点版本管理器(nvm),然后降级到节点14.17
在经历了类似的错误后为我工作:)
然后,确保您的JS项目成功构建,并且只编辑tsconfig.json文件,如https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html中所示,然后运行tsc。应该工作。