1

I'm using node v5.6.0 and bower 1.7.7 on a Mac.

I've done a npm install in my project folder which installs all the /node_modules including q. I've also done a npm install -g q just to see if that helped.

But as soon as I run bower install (or just bower) anywhere I get

ambp:~ andreaslarsen$ bower
module.js:341
    throw err;
    ^

Error: Cannot find module 'q'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/local/bin/bower:6:9)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)

Any suggestions?

Andreas Larsen
  • 101
  • 3
  • 10

3 Answers3

6

I had this problem recently. I reinstalled bower globally. npm install and "npm install -g bower" solved my problem. This downloaded the required folders in to node_modules directory globally and solved problem which I faced while installing packages with bower.

Danda
  • 380
  • 1
  • 2
  • 14
1

Turned out I just had to restart the terminal after doing the npm install and before doing the bower install

Works fine now

Andreas Larsen
  • 101
  • 3
  • 10
0

I also had this problem too, I tried a new terminal which didn't fix it, so I manually installed the missing module but it refused to find others, so upon further investigation it turned out to be a botched install of bower, which hadn't installed all its libs, so rerunning

npm install

fixed it for me.

BrokenEyes
  • 192
  • 2
  • 18