Home  >  Article  >  Web Front-end  >  How to install nodejs, npm and cnpm on Mac

How to install nodejs, npm and cnpm on Mac

php中世界最好的语言
php中世界最好的语言Original
2018-05-25 14:01:522922browse

This time I will show you how to install nodejs, npm and cnpm in Mac. What are the precautions for installing nodejs, npm and cnpm in Mac? Here is the actual combat Let’s take a look at the case.

First open the node official website

nodejs

Then you will see the following

Picture

How to install nodejs, npm and cnpm on Mac

Click on any of the above to complete the download. After the download is complete, find the file, confirm the fool-proof installation all the way, and then it will be OK.

Let’s test whether the installation is successful: Open the terminal under Mac and enter:

node -v If the version number appears, it means success:

How to install nodejs, npm and cnpm on Mac

This means the installation is successful. Now enter npm -v in the terminal. If the version number comes out as shown below:

How to install nodejs, npm and cnpm on Mac

This is it.

But after all, npm is still too slow to install some things, so it is recommended that you install cnpm to speed up your software installation. Here are the steps to install cnpm:

sudo npm install - g cnpm –registry=https://<a href="http://www.php.cn/wiki/373.html" target="_blank">registry.npm.taobao.org –verbose</a> The above line uses the Taobao image to install cnpm. If you enter cnpm -v after the installation is complete, the following appears. The content indicates success:

How to install nodejs, npm and cnpm on Mac

#The basic configuration is completed.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to use JS to merge multiple arrays to recalculate

jquery dynamically adds click event steps Detailed explanation

The above is the detailed content of How to install nodejs, npm and cnpm on Mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn