node.jsmacosnpmtaco

MAC: NPM installs modules globally but commands can't be found


Complete MAC noob here but I've been building an iOS version of my app using MacInCloud where I start a Remotebuild from terminal on to the MacInCloud, push to the MacInCloud from Visual Studio on my Windows machine, then open the xcode project on the MacInCloud and finish up the publishing process. So I finally broke down and bought my own Mac and I'm struggling to replace the MacInCloud with my local Mac.

The problem I'm having is I set up my Mac, installed Nodejs (with npm obviously) and then ran:

sudo npm install -g remotebuild

I originally ran without sudo but got the EACCES permission denied error so added sudo. Then ran:

remotebuild

Which gave me

"remotebuild: command not found"

So I verified node:

node -v

v8.11.2

I verified npm:

npm -v

5.6.0

I went to the /.npm-global/lib/node_modules folder and I can literally see the remotebuild folder and files. I've also tried opening a terminal from the bin folder under remotebuild (where the remotebuild executable actually is) and I still get a command not found error.

So then I tested something I'm a little more comfortable with: angular cli. That didn't work either

npm install -g @angular/cli@latest

ng -v

"ng: Command not found"

I've uninstalled and reinstalled Node, I've run the install for remotebuild, I've tried nvm, I'm honestly out of ideas.

Thoughts?


Solution

  • you need to ensure that npms global bin folder is added to your PATH. How you do this may depend on your shell. However you can execute npm bin -g to get the global bin folder of npm.