In this little article, we show how to install NPM on Windows using Chocolatey, which is a Linux-like packet manager like apt-get, yum & Co.
Contents
Step 0: Decision: why not using VS Code or WebStorm in your Browser?
The quickest way of starting developing with the latest stable NPM is this: just develop a browser and choose between VS Code, WebStorm or IntelliJ:
… you still would like to install NPM on your Windows system? Okay, then let us install NPM on Windows using chocolatey:
Step 1: Install Chocolatey on Windows
We are following the installation instructions on https://chocolatey.org/install:
Step 1.1: Start Powershell as Admin
Windows Search on the lower left: PowerShell –> right-click ‚Window Powershell ISE ‚ -> run as Administrator
Step 1.2: Install
Get-ExecutionPolicy # output: Restricted
If the output is Restricted, then:
Set-ExecutionPolicy AllSigned
Then we install Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Step 2: Uninstall NodeJS, if installed
Search -> programs -> search for NodeJS -> right-click (if found) –> uninstall
Step 3: Install NodeJS
In the Admin Windows Powershell, perform the command (the --force
option is needed only if the installation was attempted unsuccessfully before already).
choco install -y --force nodejs
It seems that choco install is installing the latest (unstable) version. To install a specific version, use following command instead:
choco install -y --force nodejs@v12.13.0
Step 4: Check NodeJS Version
Open a GIT Bash or an MSDOS window (search „Git Bash“ or CMD“):
node -v # output: v13.1.0
Step 5: Check NPM Version
The chocolatey installation of NodeJS also installs and activated NPM by default. We can check the version of NPM as follows:
npm i -g npm # output: 6.12.1
Step 6 (optional): Install Angular CLI
npm i -g @angular/cli@8.3.19 # or fot the latest version: # npm i -g @angular/cli # output: C:\Users\olive\AppData\Roaming\npm\ng -> C:\Users\olive\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng > @angular/cli@8.3.19 postinstall C:\Users\olive\AppData\Roaming\npm\node_modules\@angular\cli > node ./bin/postinstall/script.js + @angular/cli@8.3.19 added 102 packages from 108 contributors and updated 7 packages in 25.591s
Nodejs npm install procedure on Windows also tries to run visualstudio2017-workload-vctools, but fails when VS2022 is installed
What did you do to resolve the issue?