-bash: phonegap: command not found (Mac OS)

2019-06-04 03:31发布

问题:

I just installed phonegap and cordova using npm on my Macbook (Mac OS X Mountain Lion) using these commands on the command line.

sudo npm install -g cordova
sudo npm install -g phonegap

Both Phonegap and cordova seemed to install fine, but when I tried:

myMac:~ user$ cordova
myMac:~ user$ phonegap

I got the messages:

-bash: cordova: command not found
-bash: phonegap: command not found

both were installed, why does the command not work.

回答1:

I know that this is an old question, but I think that my answer will be helpful.

I got the same problem and solve by creating a symlink:

cd /usr/local/bin/
sudo ln -s /usr/local/Cellar/node/6.0.0/bin/phonegap phonegap
sudo ln -s /usr/local/Cellar/node/6.0.0/bin/cordova cordova

Remember to change this path /usr/local/Cellar/node/6.0.0/bin/ to yours installation folder.

[]s