NPM not working. Cannot find module 'strip ansi'

后端 未结 8 1889
小蘑菇
小蘑菇 2021-01-02 10:43

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

相关标签:
8条回答
  • 2021-01-02 10:58

    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!

    0 讨论(0)
  • 2021-01-02 10:58

    I was stuck on this problem too. Finally, I solved the issue by adding value '.js', '.ts' to resolve.extensions in my webpack.config.js. If you are using webpack too, this may help.

    0 讨论(0)
  • 2021-01-02 11:05

    I had the same issue with my next js application. What i did was uninstall strip-ansi(npm uninstall strip-ansi) and then reinstall (npm install strip-ansi)

    0 讨论(0)
  • 2021-01-02 11:08

    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.

    0 讨论(0)
  • 2021-01-02 11:13

    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.

    0 讨论(0)
  • 2021-01-02 11:14

    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.

    0 讨论(0)
提交回复
热议问题