8

I currently have installed node and npm with the installer provided from their website. Although I have homebrew installed as well, and running brew doctor seems to complain about some files installed by the node js installer at /usr/local/include/.

Is installing node through homebrew a better way (e.g. easier to manage, less errors and warnings, etc.)?

2 Answers 2

7

I find the best way to install Node.js is to use nvm, which allows you to install and manage multiple versions of Node.

I use Homebrew for pretty much everything else, but Node is easier to use through nvm, since it doesn't use global folders - everything is in your home directory, and you can easily switch between Node versions.

To install (check the website for the latest version):

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

There are some specific notes about OS X on the web site, please make sure to read through those, e.g. regarding the use of the ~/.bash_profile file.

After that, the nvm function will allow you to specify which version of node to install and use. In the simplest case, you run

nvm install node 

which will install the stable version of Node.js.

0

I would use volta to install node and npm

You need to put the volta directory (default ~/.volta/bin on your path.

Then for node (and npm would be similar)

# install Node volta install node # start using Node node 

WHat volta does is put node etc into volta's directory.

volta also allows you to use different versions of node/npm and other downloaded javascript files in different projects.

The benefit here for homebrew users is that node and npm are not in /usr/local/bin and so brew doctor will not find a problem. volta can be installed via HomeBrew.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.