Should I dow load the tarball file from the nodejs website and install it manually or should I use the package in the debian package repo?
How would one install the tarball version and update nodejs and npm to a newer version manually?
What is the recommended way to install Node.js, nvm and npm on MacOS X? - Stack Overflow
Nvm or homebrew for Node install
How should I install Node JS?
How to Install Node.js and NPM on Ubuntu 24.04?
Videos
» npm install nvm
Using
homebrewinstallnvm:brew update brew install nvm source $(brew --prefix nvm)/nvm.shAdd the last command to the
.profile,.bashrcor.zshrcfile to not run it again on every terminal start. So for example to add it to the.profilerun:echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.profileIf you have trouble with installing
nvmusingbrewyou can install it manually (see here)Using
nvminstallnodeoriojs(you can install any version you want):nvm install 0.10 # or nvm install iojs-1.2.0npmis shipping withnode(oriojs), so it will be available after installingnode(oriojs). You may want to upgrade it to the latest version:$ npm install -g npm@latestUPD Previous version was
. Thanks to @Metallica for pointing to the correct way (see the comment below).npm update -g npmUsing
npminstallionic:npm install -g ionicWhat about
ngCordova: you can install it usingnpmorbower. 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-cordovain it:npm install --save ng-cordovaUsing
bower: Install bower:npm install -g bowerAnd then go to your project folder and install
ngCordovain it:bower install --save ngCordova
PS
- Some commands may require superuser privilege
- Short variant of
npm install some_moduleisnpm i some_module
Use nvm to install Node.js, not Homebrew
In most of the answers, the recommended way to install nvm is to use Homebrew.
Don't do this.
On nvm's Github Readme is clearly says:
Homebrew installation is not supported. If you have issues with homebrew-installed
nvm, pleasebrew uninstallit, and install it using the instructions below, before filing an issue.
Use the following method instead
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
And then use nvm to install node. For example to install latest LTS version do:
nvm install 16
Clean and hassle free. It will set this as your default Node.js version as well so you should be all set.
I come across this decision every time I get a new Mac laptop/computer.
I like nvm, node version manager, because it allows me to install multiple versions of node/npm in case I need to switch within different versions.
Does homebrew offer the same? Are there other install recommendations for Mac?
The need to switch node versions does come up when asked to work on another project that is “stuck” on an older version of node due to outdated packages that no one wants to maintain but is still used in the project.
April 12, 2023 Update Thanks for all the great recommendations and insight. I decided to use fnm for my own preference at this time, but all alternatives seem great in their own way. Here is a great article from Honeybadger comparing many node environment managers: https://www.honeybadger.io/blog/node-environment-managers