NPM无法正常工作(无法找到模块'internal / fs' - nodejs) [英] NPM not working (Cannot find module 'internal/fs' - nodejs)
问题描述
更新时的NPM错误。我最近更新到Node版本7.x.现在npm不工作了。
NPM error on update. I recently update to Node version 7.x. Now npm is not working.
我无法找到错误,可能是由于 -
npm ERR!找不到模块'internal / fs'
。
运行时我得到以下信息 sudo npm update -g
-
I am unable to locate the error, it may be due to -
npm ERR! Cannot find module 'internal/fs'
.
I get the following when I run sudo npm update -g
-
npm ERR! Linux 3.13.0-101-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update" "-g"
npm ERR! node v7.1.0
npm ERR! npm v3.10.8
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'internal/fs'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
我的 /etc/profile.d/nodejs.sh
具有以下内容:
NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
export NODE_PATH
推荐答案
你应该能够删除npm目录(通常是/ usr / local / lib / node_modules / npm),然后重新安装一个官方节点tarball,其中包括npm(你可以从 http://nodejs.org/dist/latest-v7.x/ )。
You should be able to remove the npm directory (typically /usr/local/lib/node_modules/npm) and then reinstall one of the official node tarballs, which includes npm (you can find the latest from http://nodejs.org/dist/latest-v7.x/).
您是否从较旧版本的节点升级?
Did you upgrade from an older version of node?
如果是这样,这可能是您遇到此问题的部分原因。较旧版本的 graceful-fs
(npm的依赖项)执行了节点v7中不再可用的操作。
If so, that is probably part of the reason why you are having this issue. Older versions of graceful-fs
(a dependency of npm) did things that are no longer available in node v7.
这篇关于NPM无法正常工作(无法找到模块'internal / fs' - nodejs)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!