美文网首页程序员
问题解决Cannot find module 'internal

问题解决Cannot find module 'internal

作者: 到处舒卷意何长 | 来源:发表于2017-04-01 09:42 被阅读0次

今天跑一个项目的时候遇到一个报错“Cannot find module 'internal/fs'”,尝试了不少解决办法,始终没有解决,很烦躁的时候,搜到了一个解决方案<a href="https://github.com/npm/npm/issues/14232">https://github.com/npm/npm/issues/14232</a>大概的意思就是说因为npm和node版本的问题,导致出现这个错误.
我当前node版本7.8.0, npm版本4.2.0, 给出的解决方案:

$ sudo n 6.9.1
$ sudo npm -g install npm@next
$ sudo n stable

那么问题来了,这个n是个什么鬼,没有安装过,也不了解,看这里<a href="http://blog.csdn.net/jiangbo_phd/article/details/51476155">http://blog.csdn.net/jiangbo_phd/article/details/51476155</a>
n是node的一个模块,用来管理node的版本。那么这个指令的作用使用n跳回node 6.9.1, 重新全局install npm@3.10.9, n跳回之前版本。
首先我们解决n没有安装的问题

npm install -g n

安装了n之后,我们执行

$ sudo n 6.9.1
$ sudo npm -g install npm@3.10.9

重新跑了一下项目,果然可以正常运行了

相关文章

网友评论

    本文标题:问题解决Cannot find module 'internal

    本文链接:https://www.haomeiwen.com/subject/scbvottx.html