1. Download 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.
See some posts, with homebrew installation is also very easy, I lazy did not try, this way MK under: http://freemem.diandian.com/post/2012-06-02/40028564785.
Currently the latest node. JS installation is complete including NPM, and the test is installed successfully.
You can see version, the installation is successful.
2. Install 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 .
-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:
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.
3. Create an express project HelloWorld:
4. Run HelloWorld:
Open App.js,
Join:
$ 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:
Here, the node. JS environment has made birds.
Node.js,npm,express installed in Mac Environment (including Express command not found)