2022 latest Nodejs download installation configuration steps (nanny level tutorial)

1. Enter the official website and select the download version

http://nodejs.cn/download/

Select the 64-bit version under the window system

2. Installation process

Step 1: Select the next option
insert image description here
Step 2: Check the option to accept the agreement, click the next (next) button:
insert image description here
Step 3: The default installation directory is C:\Program Files\nodejs\, of course you can choose according to your needs Installation directory. Generally, I prefer to install this kind of configuration file in the default location, which is convenient for environment configuration.
insert image description here
Step 4: Here is to choose the mode you want to install. Generally, if there is no special requirement, just choose the first one.
insert image description here
Step 5: Click Install to start installing Node.js.
insert image description here
Installation process:
insert image description here
Click Finish to complete the installation and exit the installation wizard
insert image description here

3. Check whether the installation is successful

After installation, test whether it is successful in the local terminal. If the version number appears, it means success.

node -v 
 npm -v

insert image description here
(The installation was successful but there was an error)

Modify the npm file to address

Open the folder where nodejs is installed. and open two files npm.cmd and npm
this is my directory

C:\Program Files\nodejs

insert image description here
Find the prefix -g in the 2 files and replace it with prefix --location=global
1. Set the file access permissions, right-click the two folders, select properties, and click edit. Change permissions to full control. Remember that both folders are required.
insert image description here
2. Change the suffix of the second file to .txt, and then open it in Notepad respectively.
insert image description here
3. Replace prefix -g with (Note: Both files are required)

	prefix --location=global

insert image description here
4. Check whether it is successful, open a new cmd command line window at this time, win+R, enter cmd, press Enter, enter

npm -v

insert image description here
You can successfully see your version number

4. Configure environment variables

Find your own nodejs installation path and copy it.
insert image description here
Right-click My Computer, click Properties->Advanced System Settings, click Environment Variables
insert image description here
Add the path of nodejs in the system environment variable path
insert image description here

5. Configure the global installation package path

Open the cmd command line window, enter the following command, the path can be specified at will, if the path does not exist, it will be automatically generated

npm config set prefix “C:\Program Files\nodejs\node_global”
npm config set cache “C:\Program Files\nodejs\node_cache”

insert image description here
These two commands need to be executed separately. It may be that the folder cannot be generated because of administrator privileges, so it needs to be created manually.
insert image description here
After manual creation, an error is found, as shown in the figure, and
insert image description here
it is found that the file permissions are not enough. Right-click node, properties => security => Set the full control authority of the users user,
insert image description here
and then the configuration can be successfully opened
insert image description here
Open the environment variable setting window, in the user (or system) variable column, click the "New" button, add a variable name "NODE_PATH", the value is:

	C:\Program Files\nodejs\node_modules

insert image description here
In "System Variables", find the Path variable, select it and edit it. Add a value to him:
insert image description here
My Path:
insert image description here
In the "User Variables" column, set the Path variable. If not, create a new one, and set the value to
insert image description here
This nodejs setting is complete, enter node -v and npm -v respectively, and the results shown in the figure below indicate that the nodejs environment configuration is successful.
insert image description here

The following is the solution to the problem of entering npm -v at the end and 'npm' is not an internal or external command, nor is it a runnable program

First enter the path in the environment variable to find the file location of nmp,
insert image description here
open the folder and find that there is no file or only one "etc" file.
After discovering this problem, we should add the path of the npm command line execution file we installed to the environment variable.
Mine is under the "C:\Users\ASUS\nodejs" file.
insert image description here
insert image description here
After the addition is complete, run the npm command immediately.
Thank you for reading here, learning from each other, and communicating and making progress! ! !

Guess you like

Origin blog.csdn.net/Lancelot38/article/details/125887397