'npm' is not recognized as an internal or external command, operable program or batch file

'npm' is not recognized as an internal or external command, operable program or batch file

1. Download and install node.js

Link: https://nodejs.org/
insert image description here
After downloading, just choose the next step to install.

2. Problem description

After installing node.js, using npm --version may prompt that 'npm' is not an internal or external command, nor is it a executable program or batch file.
Then it is possible that the environment variable is not set properly.

3. Solve the problem

  1. Open environment variable settings
    Please add a picture description
  2. Select the Path column and click Edit
    insert image description here
  3. Configure node.js environment variables (node.js environment variable path is the path to install node)
    insert image description here

insert image description here

  1. Start the cmd command window and enter npm --version to view the version information
    insert image description here

Guess you like

Origin blog.csdn.net/qq_45844443/article/details/120130029