user2970900
user2970900

Reputation: 365

The best way to install node.js on a Mac?

Homebrew and the Node download page install node.js in different locations that apparently conflict. Brew will complain after a 'brew doctor' if both locations are used.

So, is there a preferred way to put node on my Mac(Yosemite 10.10.5).

This is what I'm getting now while attempting to install node via brew.

node-4.1.0 already installed, it's just not linked
DONs-iMac:Erlang-Elixir donfox1$ brew link node
Linking /usr/local/Cellar/node/4.1.0... 
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.

Upvotes: 9

Views: 52004

Answers (6)

Fattie
Fattie

Reputation: 12278

Simply GO HERE

https://nodejs.org/en/download

and that system dynamically determines exactly what to do based on your laptop OS, current versions etc.

Upvotes: 0

Melisa M.
Melisa M.

Reputation: 121

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

  2. nvm install 20

Read this doc: https://nodejs.org/en/download/package-manager

Upvotes: 1

Artem Sychov
Artem Sychov

Reputation: 163

If you are not sure about what version of node you need now and potentially need in the future I would also reccomend to install NVM - node version manager.
Download the nvm install script via cURL:

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

Ensure that nvm was installed correctly with nvm --version, which should return the version of nvm installed.
Install the version of Node.js you want
Install the latest version with nvm install node
Use the latest version with nvm use node
Install the latest LTS version with nvm install --lts
Use the latest LTS verison with nvm use --lts

You can also check the tutorials:
installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu
Best way to install and use nvm on Mac

Upvotes: 1

Artem Sychov
Artem Sychov

Reputation: 163

Uninstall node: sudo rm -rf /usr/local/share/systemtap/ && brew uninstall node and install nvm with brew - so you can control you node versions. Read this article: suggested way to install npm with brew

Upvotes: 1

Megha
Megha

Reputation: 433

sudo chown -R $USER /usr/local/share/ brew doctor brew install node

Upvotes: 10

Albert Tai
Albert Tai

Reputation: 141

Have you tried chmoding 755 /usr/local/share/systemtap/tapset so it is writable? That could fix it?

chmod 755 /usr/local/share/systemtap/tapset
brew link node 

Also try this if it does not work (may work):

brew cleanup
brew link node
brew uninstall node
brew install node

Upvotes: 3

Related Questions