NPM not working. Cannot find module 'strip ans

2019-02-14 12:14发布

问题:

I just downloaded node but npm is not working. whenever I use a npm comman I get Error: cannot find module 'strip-ansi'.

回答1:

For what it's worth, this ended up happening to me, using nvm on mac. npm cache clean didn't work. I ended up reinstalling via nvm:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
$ nvm install node


回答2:

I hit this same issue. I tried to update npm after a fresh Node.js install, but cancelled in the middle because it appeared stuck. Reinstalling Node.js didn't help.

I resolved the issue by deleting the temporary npm files in my AppData folder (for me on Windows, I found it in c:\Users\Me\AppData\Roaming\npm). Then I was able to run npm normally again.

Hope that helps!



回答3:

just reinstall strip using npm install strip --save this kind of error occurs because some file may be corrupt in strip library if this will not work you can try also npm install you will solve this error.



回答4:

Clear your temporary paths of npm and this is solution. if you're using linux:

go to $ cd /tmp/

search by npm-* folders

and remove all.



回答5:

It solved for me by going to the NPM install folder at /usr/local/lib/node_modules/npm and running the yarn command. After running it successfully, NPM started working normally.



回答6:

Solved by doing npm cache clean and then npm install



标签: node.js npm