Home>Article>Web Front-end> How to install node.js and npm on MacOS

How to install node.js and npm on MacOS

不言
不言 Original
2019-03-26 13:25:31 2858browse

This article will introduce how to use the Homebrew package manager to install Node.js and NPM on the MacOS operating system.

How to install node.js and npm on MacOS

Node.js is an open source, cross-platform JavaScript execution platform that uses JavaScript for server-side scripts to generate dynamic content before being sent to the client's web browser. Web page. Node.js is built on Chrome V8's JavaScript engine, allowing the creation of web servers and network tools using JavaScript. It also creates a collection of "modules" that handle various core functions such as file system I/O, networking (DNS, HTTP, TCP, TLS/SSL or UDP), binary data (buffers), encryption functions, data streaming and other core features.

First Prerequisites

Before you start installing Node.js and NPM using this tutorial, you must have the following requirements

Terminal: Must have a Mac Terminal access rights and little knowledge of using the Terminal application. Log in to your Mac system and open Terminal

Homebrew: Homebrew is a popular package manager for Mac operating systems. It is suitable for installing most open source software like Node

How to install Node.js on MacOS.

Let us start installing Node on Mac system using Homebrew. js. So first update the Homebrew package manager index. You can then install the Node.js package in your MacOS system using the following command:

$ brew update $ brew install node

You have successfully installed Node.js on your system. The default Node.js will be installed at /usr/local on your system /Cellar/node directory. Now to check and verify the installed Node.js version, execute the following command on the terminal. This will display installed version information.

$ node -v v11.0.0

Also, find the installed version of NPM that was installed with Node.js. NPM is used to manage node.js modules in the system.

$ npm -v 6.4.1

The above output shows that you have installed node.js 9.5.0 and npm 5.6.0 versions on your Mac system.

How to update node.js on MacOS

New versions of node.js are released very frequently. You can use Homebrew to update Node on your system. Just execute the following commands to update the Homebrew index and then update Node.js.

$ brew update $ brew install node

How to uninstall node.js on MacOS

Simply use the Homebrew package manager to uninstall the Node package from your system. Execute the following command from the terminal.

$ brew uninstall node

This article has ended here. For more other exciting content, you can pay attention to thenode.js video tutorialcolumn on the PHP Chinese website! ! !

The above is the detailed content of How to install node.js and npm on MacOS. 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