NPM not working. Cannot find module 'strip ans

2019-02-14 12:16发布

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

标签: node.js npm
6条回答
闹够了就滚
2楼-- · 2019-02-14 12:53

Solved by doing npm cache clean and then npm install

查看更多
祖国的老花朵
3楼-- · 2019-02-14 12:54

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!

查看更多
Deceive 欺骗
4楼-- · 2019-02-14 13:00

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楼-- · 2019-02-14 13:08

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.

查看更多
聊天终结者
6楼-- · 2019-02-14 13:11

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.

查看更多
姐就是有狂的资本
7楼-- · 2019-02-14 13:12

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
查看更多
登录 后发表回答