Error: Cannot find module 'internal/fs' when npm install on mac
5 verbose stack Error: Cannot find module 'internal/fs'
5 verbose stack at Function.Module._resolveFilename (module.js:472:15)
5 verbose stack at Function.Module._load (module.js:420:25)
5 verbose stack at Module.require (module.js:500:17)
5 verbose stack at require (internal/module.js:20:19)
5 verbose stack at evalmachine.<anonymous>:17:20
5 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1)
5 verbose stack at Module._compile (module.js:573:32)
5 verbose stack at Object.Module._extensions..js (module.js:582:10)
5 verbose stack at Module.load (module.js:490:32)
5 verbose stack at tryModuleLoad (module.js:449:12)
6 verbose cwd /Users/huweiqing
7 error Darwin 14.5.0
8 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "iconv-lite"
9 error node v7.0.0
10 error npm v3.10.8
11 error code MODULE_NOT_FOUND
12 error Cannot find module 'internal/fs'
Hm, can you read over the discussion in https://github.com/nodejs/node/issues/9355.
I'm getting a https://github.com/nodejs/node/issues/3606 vibe from these. Smells like an installer problem.
@shufanshijie
What is the output of node -v and npm -v?
How did you install Node.js?
If you run rm -rf /usr/local/lib/node_modules/npm and then re-install Node.js does it work?
Unable to reproduce the problem.
β ~ node -v
v7.0.0
β ~ npm -v
3.10.8
β ~ uname -v
Darwin Kernel Version 15.6.0: Thu Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64
β ~ npm i iconv-lite
/Users/thefourtheye
βββ [email protected]
Could be because of the stale npm installation, but not sure how that could have happened though. Please try what @Fishrock123 suggested above.
Same problem for me on a MacOsX Sierra:
$ uname -v
Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64
$ node -v
v7.0.0
$ npm -v
3.10.8
I tried to uninstall / reinstall, but it didn't fix the problem
@shufanshijie @giulio-sefaira How did you install node? With brew or nvm? Or directly from https://nodejs.org/en/download/ ?
hi @gibfahn . I used brew. I uninstalled node, wiped entirely the node_modules library (rm -rf /usr/local/lib/node_modules) and reinstalled by brew
I tried to reinstall node with brew and delete entire /usr/local/lib/node_modules, the error still happens.
@giulio-sefaira @OnceMore2020 could you please run which npm?
@Fishrock123
$ which npm
npm is /usr/local/bin/npm
npm is /usr/local/bin/npm
npm is /usr/local/bin/npm
$ /usr/local/bin/npm -v 3.10.8
get this error in Ubuntu 16.04 node -v = v7.0.0 npm -v = 3.10.8
@Leolik How did you install node?
@gibfahn sudo n latest
but after reading #9355 and removing /usr/local/lib/node_modules/ - error not reproduced
Also after removing /usr/local/lib/node_modules/ and the local project node_modules - error gone.
I solved this issue thanks to the answer of @Leolik and @fane89
I ran into this problem too, but was able to resolve it by rolling back to an older version of node/npm and forcing a "flush" of the npm module:
$ sudo n 6.
$ sudo npm install -g [email protected]
$ sudo npm install -g npm@next
$ sudo n 7.
Using Mac OS Sierra and installed Node + npm via Homebrew.
This is still not functional for me. I've gone through the thread and continue to have:
Cannot find module 'internal/fs'
verbose cli 'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Cannot find module 'internal/fs'
I've removed /usr/local/lib/node_modules/ and reinstalled node etc etc. to no avial @giulio-sefaira are you in the clear yet?
Since I assume this kind of thing is also popping up on the npm issue trackerβ¦ @nodejs/npm @KenanY do you know whatβs up with this?