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