Install nvm, npm, node.js on Mac OS

Installing Node.js via console for Mac OS.

Tested on Mac OS Ventura, M2 architecture.

Installing NVM on Mac OS

First you need to make sure that there is a file .zshrc. To do this, type in the console:

If the file is not in the list presented, then create it:

Now install NVM:

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

The official instructions are here:

https://github.com/nvm-sh/nvm#install–update-script

After installation, run the command:

export NVM_DIR=”$HOME/.nvm”
[ -s “$NVM_DIR/nvm.sh” ] && \. “$NVM_DIR/nvm.sh” # This loads nvm
[ -s “$NVM_DIR/bash_completion” ] && \. “$NVM_DIR/bash_completion” # This loads nvm bash_completion

Installing Node.js on Mac OS

There is a previous article where installing node.js ya mac through a distributor. Here we will install through the console.

Install:

We launch:

Check installed versions:

This article solves the errors:

npm install run
zsh: command not found: npm
zsh: command not found: nvm

If there are errors again, restart the console, sometimes this helps.

Using npm builders

When installing a new Node.js, the builder with older versions often stops working. This is unpleasant, because along with updating the node, you have to update the packages, and with the update of the packages, the old configs stop working. And editing all this can take a whole day. And if all this still works on other computers, then you will have to update there too. So many times you should think about whether to upgrade the node.

To update versions, we will use the article about updating package.json.

Update configs

On the example of updating the rollup.js config.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *