To publish and install packages to and from the public or a private npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. It is strongly recommended that using a Node version manager like nvm to install Node.js and npm. It is not recommended using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.
Installation Steps Link to heading
- Download and install
nvm-setup.exe
file from here. Select appropriate locations for nvm (e.g.C:\Tools\nvm
) and Node.js (e.g.C:\Tools\nodejs
) or keep as is. - Open Windows Powershell and check installed nvm version by running nvm –version command. You should get something like 1.1.12.
PS C:\Tools> nvm --version
1.1.12
- Run
nvm install --lts
or another specific version (e.g.nvm install 23.4.0
) to install Node.js and related npm versions.
PS C:\Tools> nvm install 23.4.0
Downloading node.js version 23.4.0 (64-bit)...
Extracting node and npm...
Complete
npm v10.9.2 installed successfully.
Installation complete. If you want to use this version, type
nvm use 23.4.0
- Set the version to use by running
nvm use 23.4.0
.
PS C:\Tools> nvm use 23.4.0
Now using node v23.4.0 (64-bit)
- Setting default version of the node to one of the installed versions does not work for nvm-windows installations so you need to switch between different versions using
nvm use <version>
command.
PS C:\Tools> nvm use 23.4.0
Now using node v23.4.0 (64-bit)
- Check versions of node.js and npm.
PS C:\Tools> node -v
v23.4.0
PS C:\Tools> npm -v
10.9.2
- That’s it!