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.

choco install -y --force nodejs

Step 1: Install Chocolatey on Windows

We are following the installation instructions on https://chocolatey.org/install:

Step 1.1: Start Powershell as Admin

Start Windows Powershell ISE as Administrator

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

Windows Uninstall NodeJS

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

Done

Comments

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.