0

On Ubuntu 12.04 x 64...

npm -g install hiredis redis

Installs fine and npm ls shows those modules, but only when I'm in node source directory

does not show when I'm in any other directory

For kicks, tried running the command while in that other directory- still no dice :(

davidkomer
  • 3,020
  • 2
  • 23
  • 58

2 Answers2

1

They are installing globally, but you cannot see them with npm ls, in other directories. Because npm ls only shows local modules. If you want to list global modules you have to type: npm ls -g.

anvarik
  • 6,417
  • 5
  • 39
  • 53
0

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 for ubuntu of course)
  4. Reinstall the module/package you tried to install, don't forget -g for global.

lilotop
  • 527
  • 6
  • 12