NPM无法正常工作.找不到模块'strip ansi'

use*_*968 6 node.js npm

我刚刚下载了节点,但是npm无法正常工作.每当我使用npm命令时,我得到错误:找不到模块'strip-ansi'.

swh*_*man 15

对于它的价值,最终发生在我身上,使用Mac上的nvm.npm cache clean没用.我最终通过nvm重新安装:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
$ nvm install node
Run Code Online (Sandbox Code Playgroud)


小智 7

我也被这个问题困扰了。最后,我通过'.js', '.ts'resolve.extensions我的webpack.config.js. 如果您也使用 webpack,这可能会有所帮助。


Ale*_*lex 4

只需使用重新安装 Stripnpm install strip --save就会发生这种错误,因为 Strip 库中的某些文件可能已损坏,如果这不起作用,您也可以尝试,npm install您也将解决此错误。