Home > Back-end >  why npm hangs on installing packages? hanging on idealTree
why npm hangs on installing packages? hanging on idealTree

Time:10-15

I tried to use npm install in a react app but it hangs on idealTree:myProject: sill idealTree buildDeps I have tried several things:

1-reinstalling node

2-removing or adding package-lock.json

3-using npm i registry.npmjs.org

4-npm cache clean --force

5-npm config set registry http://registry.npmjs.org/

I also tried npm install --verbose and this is the result

beside that I even cant run npx create-react-app myApp and I get this error although I don't use proxy . so what should I do? apparently I can not use any npm package now.

UPDATE : I tried to change npm registry and set it to https://skimdb.npmjs.com/registry. this time it started to install packages but at middle of it I got these errors

npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at 
https://skimdb.npmjs.com/registry/@types/eslint reason: 
Invalid response body while trying to fetch 
https://skimdb.npmjs.com/registry/@types/eslint: Socket timeout

CodePudding user response:

Probably your internet connection is slow, try with a fast network, hopefully, the problem will be solved.

CodePudding user response:

Ok it seems that the problem is because of my network connection and some how I can not have access to https//registry.npmjs.org. and I manage to solve it and install packages with yarn. the only thing you might need to change if you can not install packages even with yarn is to change the registry try to use yarn config set registry https://registry.yarnpkg.com

also if after that you have problem with npm start or yarn start try to edit your package.json like this

"scripts": {"start": "react-scripts --openssl-legacy-provider start" ,"build": "react-scripts --openssl-legacy-provider build" }

  • Related