Install Node.js in MacOS system environment

Step 1: Visit the official website of Node.js

Visit the official website address of Node.js: https://nodejs.org/zh-cn/ , as shown below:

Insert picture description here

Node.js officially provides two versions: one is the long-term support version and the other is the latest version. It is recommended to download the long-term support version, because this version is more stable. As shown below:

Insert picture description here

Select the long-term support version (click the button above) and download the installation file for the Mac system. As shown below:

Insert picture description here

Step 2: Install Node.js environment

1. Double-click the installation file of Node.js to enter the installation interface of Node.js. As shown below:

Insert picture description here

2. Click the [Continue] button in the lower right corner to continue installing the Node.js environment. As shown below:

Insert picture description here

As shown in the figure above, it shows the official "Software License Agreement" of Node.js.

3. Under normal circumstances, click the [Continue] button to agree and continue to install the Node.js environment. As shown below:

Insert picture description here

4. Click the [Agree] button to agree to the content of the Node.js software license agreement.

Insert picture description here

As shown in the figure above, you can choose the installation path (the default is fine).

5. Click the [Install] button to indicate the environment for installing Node.js. As shown below:

Insert picture description here

As shown in the figure above, when installing the software on the Mac system, the user name and password of the current system are required to install the software correctly.

6. Here you need to enter your username and password, and click the [Install Software] button to start the real installation of the Node.js environment. As shown below:

Insert picture description here

As shown in the figure above, the installation program will automatically start installing the Node.js environment until the installation is complete. As shown below:

Insert picture description here

As shown in the figure above, after providing the "installation successful" message, click the [Close] button to end the installation steps of the Node.js environment.

Step 3: Verify whether Node.js is installed successfully

1. Run the "Terminal" program under Mac system, as shown below:

Insert picture description here

2. Enter the following command in the "Terminal" program to verify whether the Node.js environment is installed successfully.

node -v

If the prompt content as shown in the figure below appears in the "terminal" program, it means that the Node.js environment is installed successfully. As shown below:

Insert picture description here

It should be noted that the node -v command means to view the version of the current Node.js environment.

Step 4: Verify that the npm package manager is available

1. Run the "Terminal" program under Mac system, as shown below:

Insert picture description here

2. Enter the following command in the "Terminal" program to verify whether the npm package manager is available.

npm -v

If the prompt content as shown in the figure below appears in the "terminal" program, it means that the npm package manager is available. As shown below:

Insert picture description here

It should be noted that: the npm -v command means to view the current version of the npm package manager.

Guess you like

Origin blog.csdn.net/u013575441/article/details/108742936