npm-on-windows

This is the guideline for nodejs + npm installation on Windows (including windows 7)

Description

npm and Node.js are quite common to the developers but they are unfriendly to Windows.

If you use .msi installation, it usually fails. (see https://github.com/npm/npmlog/issues/48)

Here is to introduce a proper method for its installation.

Official Files

| Item | Version | Release Date | Download | | ———————- | ————– | ————- | ——————————————————————– | | Node.js (Windows 7) | v12.22.6 (LTS) | 31-Aug-2021 | https://nodejs.org/download/release/v12.22.6/win-x64/node.exe
2E820E1C7688484024BFAF13E8F9E11F - 28.8 MB | | Node.js (Windows 8.1+) | v14.17.6 (LTS) | 31-Aug-2021 | https://nodejs.org/download/release/v14.17.6/win-x64/node.exe
  | | npm (Windows 7+) | 1.4.9 (zip) | 01-May-2014 | https://nodejs.org/dist/npm/npm-1.4.9.zip
7CD8BA6F4582C81709B6705978B4B9ED - 2.19MB |

Node.js v13?

npm 1.4.9?

Official Releases

Screenshot 1

qwcdsvf

Screenshot 2

qdsvfdbt

Installation Guide for Node v12

see https://github.com/cyfung1031/npm-on-windows/blob/main/README_backup_20211013.md

Installation Guide for Node v14.17.6 on windows 7

The following installations is to Node.js v14.17.6 and npm v6.14.15.

(For your own installation, you shall refer the corresponding npm version in https://nodejs.org/en/download/releases/ )

Part A - Basic Files for nodejs and npm

  1. Download https://nodejs.org/download/release/v14.17.6/node-v14.17.6-win-x64.zip
  2. Extract the files node.exe, npm.cmd, and node_modules into C:\nodejs

explorer-downloaded

  1. Add System Variable NODE_SKIP_PLATFORM_CHECK = 1

Go to control panel -> System -> Advanced System Settings then environment variables. under system variables i created a new one with NODE_SKIP_PLATFORM_CHECK and set its value to 1.

  1. Open cmd and type to check the following:
    C:
    cd nodejs
    node -v //display "v14.17.6"
    npm -v //display "v6.14.15"
    

Part B - Set your folder locations

  1. Create Empty Directories C:\nodejs\node_global and C:\nodejs\node_cache

  2. add PATH C:\nodejs\\;C:\nodejs\node_global\\;

1423556-20190119151816709-12654710231423556-20190119152556038-514540680

  1. add system variable “NODE_PATH” as C:\nodejs\node_global\node_modules

1423556-20190119151816709-12654710231423556-20190119152300535-790205673

  1. Open cmd and type to check the following:
    npm config set prefix "C:\nodejs\node_global"
    npm config set cache "C:\nodejs\node_cache"
    
    • Note 1: As you have added the path C:\nodejs\ to your system environment, C: cd nodejs is no longer required.
    • Note 2: You can edit the text file %HOMEPATH%\.npmrc for the same effect.

Part C - Install the npm to node_global

  1. Type the following to install the npm in your C:\nodejs\node_global
    npm install -g npm@6.14.15
    
    • Note: You can find npm.cmd and npx.cmd in C:\nodejs\node_global after installation
  2. Remove the unnecessary old npm files in “C:\nodejs” - leaving only “node.exe”, “node_global” and “node_cache”
  3. image

  4. Open cmd and type to check the following:
    cd nodejs
    node -v //display "v14.17.6"
    npm -v //display "v6.14.15"
    

Appendix

Install Yarn

npm install --global yarn

Install Vue CLI

npm install --global @vue/cli

Install A Package Locally

npm install xxxx

Run A Package Installed Locally

npx xxxx .....

VS Code

cd xxxxx
code .