Before proceeding with installation you need to consider the Node.js version you will be using. Essentially, there are two (2) options to choose from:
- Long-time-support (LTS);
- Latest Node.js version.
If you are new to Node.js, I would suggest to go with the LTS version to avoid incompatibilities with packages (such as strapi).
-
Download the dmg archive (
latestorLTS- depending on your preference), which comes bundled with Node.js and the npm client. If you don't know which file to download look for the "macOS Installer"; -
Execute the downloaded file and follow instructions;
-
Verify node.js and npm have been installed.
node --version
npm --version
brew install nodeAt the time of writing the LTS version is 14.x.
brew install node@14If you are planning to publishing modules to the npm registry you should login with your npm account.
-
Visit https://www.npmjs.com/signup and create a npm account. Skip this step if you already have a npm account;
-
Login to npm from your machine;
npm login
-
Verify you are logged in to npm.
npm whoami
You should be able to see your username displayed in the terminal.
- Append the following to your
~/.bash_profileor~/.zshrc;
export NPM_TOKEN=$(cat ~/.npmrc | awk -F'authToken=' '{print $2;exit;}')- Create a new
/.npmrcfile in the root folder of your project, with the following contents;
//registry.npmjs.org/:_authToken=${NPM_TOKEN}