
Today npm stopped working
I went to start a new project and did my usual housekeeping
npm init -y
git init
npm i aws-sdkAnd today npm decided to hang on the install.
Cancel, rm modules folder, reinstall.... hang
It didn't seem to matter what I was installing.... npm was stuck. It gave me error logs, which weren't helpful. And then I started to get npm maximum call stack size exceeded errors. Ugh..... so much for getting anything done today.
I tried the usual remedies.
rm -rf ./node_modules
npm cache clean --force
npm rebuildI tried on a fresh directory. Nothing made a difference.
Then I tried npm i -g npm just for kicks and giggles.
Weirdly, after I ran that command, I could get one subsequent npm command to work. Then the following commands would hang.
I ran npm config edit which loaded the .npmrc file. I didn't edit anything, but after that npm started to work again. Just for good measure, I added a local .npmrc in my directory.
The moral of the story is sometimes things just stop working.
Happy coding.