bower: Error: Cannot find module 'internal/fs'
Output of bower -v && npm -v && node -v:
1.8.0
3.10.9
v7.1.0
Steps to reproduce the issue:
- clone https://github.com/officert/mongotron
- run
npm i
Describe the results you received:
Looks like the old version of graceful-fs doesn’t work anymore (on node 7?). Latest version from git works fine.
> Mongotron@1.0.0-alpha.5 postinstall /tmp/mongotron
> bower install && gulp dev-sym-links
module.js:474
throw err;
^
Error: Cannot find module 'internal/fs'
at Function.Module._resolveFilename (module.js:472:15)
at Function.Module._load (module.js:420:25)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at evalmachine.<anonymous>:17:20
at Object.<anonymous> (/tmp/mongotron/node_modules/bower/node_modules/graceful-fs/fs.js:11:1)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN mongodb-core@1.2.30 requires a peer of kerberos@~0.0 but none was installed.
npm ERR! Linux 4.8.6-2-ck
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i"
npm ERR! node v7.1.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! Mongotron@1.0.0-alpha.5 postinstall: `bower install && gulp dev-sym-links`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Mongotron@1.0.0-alpha.5 postinstall script 'bower install && gulp dev-sym-links'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Mongotron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bower install && gulp dev-sym-links
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Mongotron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls Mongotron
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/mongotron/npm-debug.log
Describe the results you expected: it should work fine
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 19
- Comments: 23
@BrennerSpear try run bower locally (npm install bower) and
works for me.
@AlokJoshi Glad to help. The point here is that your global bower instance is out of date in relation to the node version. I suggest to uninstall the global bower instance, then install it again and it should work globally.
@oliverjanik I suppose this problem is related to a mismatch between node and bower versions.
I used to manage packages with an old bower version i installed globally (-g option) months and months ago. Then I recently upgraded node to 7.6.0 and my global bower stopped working.
So i’ve
npm install bowernode_modules/bower/bin/bower install whateverAlso, one should remove his global bower instance and replace it with a fresh one.
+1, windows node v7.4.0 npm 4.0.5
Running “bower -v” failed with the same error message. Hence I (re-)installed bower by “npm install bower -g” and it installed version 1.8.0. bower 1.8.0
Well, the good thing is that the error message is now gone! After this I could install the package I wanted in the first place.
FWIW I get this error when when the
bowercommand is in both my nvm installed global node packages as well as my/usr/local/lib/node_modules. The former being installed via annpm i bower -g. when I do awhich bowerbefore installing the latest bower I get/usr/local/bin/bowerthat’s aliased to/usr/local/lib/node_modules/bower/bin/bower. After I install I get/Users/cwd/.nvm/versions/node/v8.6.0/bin/bowerbut this isn’t the version that seems to execute. The older one does. Executing directly from/Users/cwd/.nvm/versions/node/v8.6.0/bin/bowerseems to work just fine so I think it’s an symlinking or PATH issue. At least in my casejust installing (globally) bower again worked for me
npm install -g bowerInstall bower and put bower command path into system environment path…
@AlokJoshi try to move to a different directory and install a local bower instance
What’s the output?
@brazorf yes, reinstalling bower globally solves the problem. I think the issue can be closed.
OSX El Capitan (10.11.6)
using n (the node version manager) I switched to
node v4.4.2and then didbower install. I was onbower 1.5.x, it suggested I update tobower 1.8.0. I updated it, and then switched back tonode 7.4.0, at which pointbower -vgives me1.8.0, and I can successfullybower installwhatever project packages I want.