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'
I removed node_modules in project, and npm install, it's worked for me
@Fishrock123, Thanks,it works,on removing node and npm, and then reinstalling them removes the problem
I have reinstalled the node, also trying to remove node_modules, but still not make the error gone. The error keep occurred with latest version of node (v7.5.0)
So I tried to install latest stable of node 6 (node v6.9.5) by using n, then everything going fine
brew uninstall node
rm -rf /usr/local/lib/node_modules
brew cleanup
brew install node
npm install -g n
n 6.9.5
npm -v # v6.9.5
npm install -g bower
I hava solved that.
1.rm -rf node_modules
2.npm install
Delete all the dependencies of the project.
Reinstall.
In my case I just need it to update to the latest version of bower on package.json to fix my problem.
I fixed this by installing the latest version of the package that it was complaining about:
npm install --save vinyl-fs@latest
If you're using nvm, you can run nvm use 0.10 to fix this issue
@pwgraham91 I don't think that's the actual solution - that's just changing your node version
@niftylettuce you're right, my issue was that node was too old. installing vinyl didn't fix it for me
@pwgraham91 what is the full output of your error in particular?
$ npm install
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
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>
npm ERR! Please include the following file with any support request:
npm ERR! npm-debug.log
There should be more output than that @pwgraham91 -- feel free to email me directly so we don't pollute the thread maybe?
I ran into the same issue on Windows after installing Node 7.7.3 into previous' installation folder (0.12.*).
npm installed with installer was 4.1.2 (I've checked in package.json since npm -v did not work too), so I've downloaded newest npm (4.4.1) from registry and unpacked it into Node's node_modules. It works now :-)
Thanks, @Wirone, I had this issue with 4.1.2 and that did it for me too.
On windows 8 i got this solved by deleting the folder C:\Users\<your_username>\AppData\Roaming\npm\node_modules
and running
npm install -g npm
There after i ran the installation of react-native via
npm install -g react-native-cli
then it worked 👍
Previous error that I was receiving was
C:\Windows\system32>npm install -g react-native-cli
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\<username>\\AppData
\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "react-native
-cli"
npm ERR! node v7.9.0
npm ERR! npm v3.7.2
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>
npm ERR! Please include the following file with any support request:
npm ERR! C:\Windows\system32\npm-debug.log
I had this same issue and was able to resolve it by simply deleting the node_modules folder and running npm install again.
What worked for me was re-installing everything I need for my project.
Uninstall
# Uninstall nvm
nvm use system
rm -rf ~/.nvm
# Remove node
brew uninstall --ignore-dependencies --force node
# Remove yarn
brew uninstall --force yarn
brew uninstall -g nvm
# Clear cache
brew prune && brew cleanup
Install
brew install node
brew install nvm
brew install yarn
nvm install
nvm use
npm install -g bower ember-cli netlify-cli # ... and any other globals you need
If you're doing the same, pay attention to output of each command telling you to configure your shell environment variables.
My environment
- Node.js: v7.9.0
- NPM: 4.2.0
- Yarn: 0.23.2
- macOS: Sierra 10.12.4 (16E195)
In my case the solution mentioned by @kriskhaira did not work. Since I couldn't upgrade the graceful-fs dependencies I ended up downgrading to node 6 which fixed the issue.
Seen this issue with v7.10.0, solution was downgrading to v6.10.3 like @balinterdi mentioned. Also needed to remove node_modules and reinstall.
Ran into this issue when using lerna bootstrap. Nothing suggested here was feasible or worked, so in the end the simple solution was to use yarn instead via lerna bootstrap --npm-client=yarn
This was with Node 8 and npm 5 btw.