You should install node.js with nvm, because that way you do not have to provide superuser privileges when installing global packages (you can simply execute "npm install -g packagename" without prepending 'sudo').
Brew is fantastic for other things, however. I tend to be biased towards Bower whenever I have the option to install something with Bower.
I've seen a few places suggested that you should use Homebrew to install Node (like alexpods answer and in this Team Treehouse blog Post) but installing this way you're more prone to run into issues as npm and brew are both package managers and you should have a package manager manage another package manager this leads to problems, like this bug offical npm issues Error: Refusing to delete: /usr/local/bin/npm or this Can't uninstall npm module on OSX
Also, using the Homebrew installation of npm will require you to use sudo when installing global packages. Since one of the core ideas behind Homebrew is that apps can be installed without giving them root access, this is a bad idea.
For Everything else
I'd use npm; but you really should just follow the install instruction for each modules following the directions on there website as they will be more aware of any issue or bug they have than anyone else
Add the last command to the .profile, .bashrc or .zshrc file to not run it again on every terminal start. So for example to add it to the .profile run:
If you have trouble with installing nvm using brew you can install it manually (see here)
Using nvm install node or iojs (you can install any version you want):
nvm install 0.10
# or
nvm install iojs-1.2.0
npm is shipping with node (or iojs), so it will be available after installing node (or iojs). You may want to upgrade it to the latest version:
$ npm install -g npm@latest
UPD Previous version was npm update -g npm. Thanks to @Metallica for pointing to the correct way (look at the comment bellow).
Using npm install ionic:
npm install -g ionic
What about ngCordova: you can install it using npm or bower. I don't know what variant is more fit for you, it depends on the package manager you want to use for the client side. So I'll describe them both:
Using npm: Go to your project folder and install ng-cordova in it:
npm install --save ng-cordova
Using bower: Install bower:
npm install -g bower
And then go to your project folder and install ngCordova in it:
bower install --save ngCordova
PS
Some commands may require superuser privilege
Short variant of npm install some_module is npm i some_module
You should install node.js with nvm, because that way you do not have to provide superuser privileges when installing global packages (you can simply execute "npm install -g packagename" without prepending 'sudo').
Brew is fantastic for other things, however. I tend to be biased towards Bower whenever I have the option to install something with Bower.
I'm super late to this but I didn't like the other answers
Installing Homebrew
For brew run
Installing node & npm
You SHOULD NOT use
brew
to install node and npm.I've seen a few places suggested that you should use Homebrew to install Node (like alexpods answer and in this Team Treehouse blog Post) but installing this way you're more prone to run into issues as
npm
andbrew
are both package managers and you should have a package manager manage another package manager this leads to problems, like this bug offical npm issues Error: Refusing to delete: /usr/local/bin/npm or this Can't uninstall npm module on OSXYou can read more on the topic in DanHerbert's post Fixing npm On Mac OS X for Homebrew Users, where he goes on to say
For Everything else
I'd use npm; but you really should just follow the install instruction for each modules following the directions on there website as they will be more aware of any issue or bug they have than anyone else
Using
homebrew
installnvm
:Add the last command to the
.profile
,.bashrc
or.zshrc
file to not run it again on every terminal start. So for example to add it to the.profile
run:If you have trouble with installing
nvm
usingbrew
you can install it manually (see here)Using
nvm
installnode
oriojs
(you can install any version you want):npm
is shipping withnode
(oriojs
), so it will be available after installingnode
(oriojs
). You may want to upgrade it to the latest version:UPD Previous version was
. Thanks to @Metallica for pointing to the correct way (look at the comment bellow).npm update -g npm
Using
npm
installionic
:What about
ngCordova
: you can install it usingnpm
orbower
. I don't know what variant is more fit for you, it depends on the package manager you want to use for the client side. So I'll describe them both:Using
npm
: Go to your project folder and installng-cordova
in it:Using
bower
: Install bower:And then go to your project folder and install
ngCordova
in it:PS
npm install some_module
isnpm i some_module