You will need Node.js and npm to be installed on your system. Node.js installer
is not recommended, since the Node installation process installs npm
in a directory with local permissions and can cause permissions errors when you run npm packages globally. Node version manager like nvm is usually recommended as explained below.
nvm
: Node version manager to installNode.js
andnpm
:- Windows:
- Donwload the latest release of
nvm-windows
. - Click on
.exe
file to install the latest release. - Complete the installation wizard
- When done, you can confirm that nvm has been installed by running:
nvm -m
- Donwload the latest release of
- Unix/MacOS:
- In your terminal, run the nvm installer by using
cURL
orWget
commands depending on the command available on your device. These commands will clone the nvm repository to a~/.nvm
directory on your device:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash #or wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
- Update your profile configuration: Running either of the above commands downloads a script and runs it. The script clones the nvm repository to
~/.nvm
, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile
,~/.zshrc
,~/.profile
, or~/.bashrc
). If it doesn't automatically add nvm configuration, you can add it yourself to your profile file:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- When done, you can confirm that nvm has been installed by running:
command -v nvm
- If you run into problems, you can check the complete documentation.
- In your terminal, run the nvm installer by using
- Windows:
Node.js
andnpm
: Usenvm
to install, and use, the version ofNode.js
andnpm
defined in the.nvmrc
file:nvm use
Verify it worked by running:nvm install
node --version
npm --version