1

i'm trying to run my typescript project using tsc but i get this error:

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

I tried updating one of the modules like this but it didnt work:

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

nor did this work:

% npm i npm@latest
...
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! zlib: incorrect data check

any ideas?

Aidan Bell
  • 13
  • 3

1 Answers1

0

There's apparently a bug in the most recent version of node, see Zlib error when attempting to run npm install or yarn

you need do downgrade yarn and reinstall typescript

make sure you have node version manager (nvm) installed, then downgrade to node 14.17

nvm install 14.17
nvm alias default 14.17

npm install typescript --save-dev
tsc

worked for me after experiencing a similar error :)

then, ensure your JS project builds successfully, and only edit the tsconfig.json file as in https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html and then run tsc. should work.

morace80
  • 41
  • 2