I have a Mac OS X version 10.9.1. I tried installing PhoneGap via the command line
$ sudo npm install -g phonegap
BUT i get the following error:
sudo: npm: command not found
You need to have the Node Package Manager installed on your system.
This requires you to install Node.js
If your npm isn't installed in /usr/local/bin, you must create a symbolic link for it first.
$ sudo ln -s $(which npm) /usr/local/bin/npm
$ sudo npm install -g phonegap
If u already install Node package and still getting the same error, then check the bin (/usr/local/bin) folder permission.
If you don't have enough permission then change folder the permission using below command.
sudo chmod -R 777 /usr/local/bin
I have shared my whole experience while installing the phone gap is here
https://sites.google.com/site/greateindiaclub/mobil-apps/ios/phonegapinstalltionwithnodejs
The phonegap is installed using the node package manager(NPM) , the package is not available on your pc , so you need to install it.
use this command to install,
sudo apt-get install npm
It will fix the issue. then do the installation command .
In one of the answers to the question suggesting chmod -R 777 - I must warn against using.
chmod -R 777 /usr/local/bin
This means that all files in bin and its subdirectories will be readable, writable and executable by the whole world.
If one did so by accident, as minimum change it to
chmod -R 755 /usr/local/bin
and then think closer about how the permissions should be set after that.
you are getting this error because you do not have NODE packages installed in your machine. Download and install it before running npm install command from below link https://nodejs.org/en/download/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.