vjjj vjjj - 1 year ago 420
Node.js Question

NPM not working (Cannot find module 'internal/fs' - nodejs)

NPM error on update. I recently update to Node version 7.x. Now npm is not working.

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! 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>

has the following contents:

export NODE_PATH

Answer Source

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?

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download