user3125462
user3125462

Reputation: 61

Installing Bower globally using npm

I am trying to install Bower globally and it is installed in the directory of

C:\Users\{{user}}\AppData\Roaming\npm\node_modules\bower

I have added the system path of Path and NODE_PATH to that of above, however when running bower, it still cant find the modules.

the prefix of npm-config is:

C:\Users\{{user}}\AppData\Roaming\npm

however later within the the list it states it as "C:\Program Files (x86)\nodejs" (overridden)

Ive run out of ideas of what it could be,

Upvotes: 2

Views: 10929

Answers (2)

mugabits
mugabits

Reputation: 1035

If you using npm, which looks like you are, then use the global flag (run as admin)

npm install -g bower

Upvotes: 15

lilotop
lilotop

Reputation: 577

Sometimes another version or just a wrong path is referenced in the npm config file instead of the installed version.

This may cause node/npm to misplace global modules.

To check and fix:

  1. In cmd line type: npm config list
    You should get a list of configuration values, one of them is prefix.
  2. Make sure the path in prefix is the same path (only without node.exe) as the actually installed node.exe path.
    (this path is listed further down as node bin location)
  3. If it's not, change it:

    • Either in the config file (in your user folder, named .npmrc)
    • Or, via cmd line: npm config set prefix "C:\Program Files\nodejs" (change path if needed)
  4. Reinstall the module/package you tried to install, don't forget -g for global.

Upvotes: 1

Related Questions