jay
jay

Reputation: 1524

Cannot run globally installed node modules

I cannot get my Mac OS 10.8.5 to find the modules that npm installed globally. I am trying to execute bbb from the command line, but when I try to execute it, I get

   $ bbb
    -bash: bbb: command not found

I believe it is installed correctly:

  $ npm ls -g | grep bbb
    ├── [email protected]
    ├─┬ [email protected]
    ├─┬ [email protected]
    ├─┬ [email protected]
    ├─┬ [email protected]

Lots of people recommended putting /usr/local/share/npm/bin in their $PATH so I tried that:

$ env | grep PATH
PATH=/usr/local/bin:/usr/local/opt/ruby/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/opt/ruby/bin:/usr/local/share/npm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
NODE_PATH=/usr/local/lib/node_modules

Does anyone have any other ideas with what can be going wrong? Thanks.

Upvotes: 3

Views: 3556

Answers (2)

user566245
user566245

Reputation: 4227

the bin of the location where your npm is installing the global packages needs to be in your path.

For example when i install a global package i get:

npm install -g npm-check-updates /usr/local/Cellar/node/0.10.32/bin/ncu -> /usr/local/Cellar/node/0.10.32/lib/node_modules/npm-check-updates/bin/ncu /usr/local/Cellar/node/0.10.32/bin/npm-check-updates -> /usr/local/Cellar/node/0.10.32/lib/node_modules/npm-check-updates/bin/npm-check-updates

You can see in the output above that directory where my executable files are is: /usr/local/Cellar/node/0.10.32/bin. So in my case I have added that location to my path.

Check your bin location and add that.

Upvotes: 0

hexacyanide
hexacyanide

Reputation: 91639

If you look in bbb's package.json, it has no bin property, so you can't execute the command from the command line because it was not written to have command line functionality. Not all Node.js modules are created with use on the command line.

Upvotes: 1

Related Questions