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'
Also ran into this issue when on Node 8. Set my nvm to v6.10.3 fixed the issue.
@adamreisnz @haleyparty Could (one of) you create a new issue with full stack trace? Thanks!
@TimothyGu Will do now!
For posterity: https://github.com/nodejs/node/issues/13361
Hi,
ive removed all the node.js package on my OS
apt-get purge node.js
and manually remove/clear
/home/user*/(.npm,.ionic), /root/(.npm,.ionic), /usr/lib/node_modules
manual removal of the remainder helped and update your OS and new install node.js and ionic
cu
Hi,
ive removed all the node.js package on my OS
apt-get purge node.js
and manually remove/clear
/home/user*/(.npm,.ionic), /root/(.npm,.ionic), /usr/lib/node_modules
manual removal of the remainder helped and update your OS and new install node.js and ionic
cu
On Windows, I confirm that deleting the directory :
C:\Users<your_username>\AppData\Roaming\npm\node_modules
solves the issue.
@Fishrock123 Solution works for me on node v8.1.3 and npm 5.0.3
@Fishrock123 solution is generally working 💥
If it's not working for you make sure that your version of npm is actually under /usr/local/lib/node_modules/npm. Run which npm. For node installed e.g. through ansible nodejs role it can be in: ~/nodejs/bin/npm. If that's the case then you want to rm -rf ~/nodejs/lib/node_modules/npm. Reinstall and you should be fine.
I get this error when I switched to older node with nvm.
Here my solution. I tried in console which bower it gives me /usr/bin/bower it was symlink to /usr/lib/node_modules/bower/bin/bower so I just removed symlink sudo rm /usr/bin/bower and removed module itself rm -rf /usr/lib/node_modules/bower and installed bower again npm i -g bower. After that was no error
For me this error came after using gulp serve command on angular1-gulp project, by removing the local node_modules folder and doing npm install solved this error.
node 7.9.0
npm 4.2.0
node installed using nvm version 0.25.1
Mac OS Sierra.
Hope this will help someone. Cheers !
I also experienced it lately and solved it in the following way. For me there was a conflict but at the system level and it was caused by not cleaned properly, old nodejs installation. I couldn't use latest bower package, so after reading your comments
>whereis node_modules
node_modules: /usr/lib/node_modules /usr/local/lib/node_modules
I've deleted the second directory as it was for nodejs 6.x, and all returned to normal.
Cheers
I had a similar problem and it seems that reinstalling gulp and also deleting node_modules directory in my project folder fixed the problem. I use node version 8.0.0 and npm 5.0.0.
EDIT ~ I mean this is for people having problem with graceful-fs module working with gulp.
I ran into this issue as well when using lerna bootstrap. Turned out I had a node_modules folder in my home directory that had a copy of NPM in it that lerna was using. No idea how that got there, but removing it did the trick.
Reference solution: https://github.com/nodejs/node/issues/9355