Node.js Installing Node.js Installing with Node Version Manager under Fish Shell with Oh My Fish!

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Node Version Manager (nvm) greatly simplifies the management of Node.js versions, their installation, and removes the need for sudo when dealing with packages (e.g. npm install ...). Fish Shell (fish) "is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family" that is a popular alternative among programmers to common shells such as bash. Lastly, Oh My Fish (omf) allows for customizing and installing packages within Fish shell.

This guide assumes you are already using Fish as your shell.

Install nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash

Install Oh My Fish

curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish

(Note: You will be prompted to restart your terminal at this point. Go ahead and do so now.)

Install plugin-nvm for Oh My Fish

We will install plugin-nvm via Oh My Fish to expose nvm capabilities within the Fish shell:

omf install nvm

Install Node.js with Node Version Manager

You are now ready to use nvm. You may install and use the version of Node.js of your liking. Some examples:

  • Install the most recent Node version: nvm install node
  • Install 6.3.1 specifically: nvm install 6.3.1
  • List installed verisons: nvm ls
  • Switch to a previously installed 4.3.1: nvm use 4.3.1

Final Notes

Remember again, that we no longer need sudo when dealing with Node.js using this method! Node versions, packages, and so on are installed in your home directory.



Got any Node.js Question?