Install node. js, NPM, Express in a Mac environment

Source: Internet
Author: User
Tags install node

One: node. js Ann Turns

Method One: Download the node. js for Mac

Address: http://nodejs.org/download/

Download the pkg directly, double-click the installation, all the way to next, it is easy to get it done.

The installation will alert you that the path to node and NPM is/usr/local/bin.

Method Two: Install with homebrew

1. Installing homebrew

Homebrew installation is very simple, open the terminal copy, paste the following command, enter, done.

Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrew Installation Nodejs

Brew Install Nodejs

currently the latest node. JS installation is complete including NPM , tested for installation success

luoyindemacbook-pro:~ luoyin$ node-vv5.1.0luoyindemacbook-pro:~ luoyin$ npm-v3.3.12

See version, installation succeeded.

Two: Install Express

Open the Command line tool and enter the following:

NPM Install-g Express

Using the system current user installation error, prompt "Please try running the This command again as Root/administrator."

Use the sudo command to get root, and you need to enter a password here .

sudo npm Install-g Express

-G is a global installation, if you want to install the specified version you can use sudo npm install-g [email protected] version number.

Install Express again to test if the installation was successful:

Express-v

The following results appear:

-bash:express:command not found

The Express command was found to be unrecognized and checked: The XPRESS4 version separates the command line tool Express separately from the Express-generator package and the old version is integrated.

You need to install a command line tool.

sudo npm install-g express-generator

You can now use the previous method to detect if the express installation was successful.

Three: Create an express project

Command line Input: (Helloworldexpress is the project name)

$ Express Helloworldexpress

Run HelloWorld:

Open App.js,

Join:

Command Line Input:

$ cd helloworld$ NPM install $ node app.js

When installing, if you need root permission again, change $ sudo npm install, OK.

Open Browser input: localhost:8080:

In this case, the node. JS Environment is working.

Install node. js, NPM, Express in a Mac environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.