Nodejs Express installation on Mac

Source: Internet
Author: User

Recently set up the NODEJS environment on Mac and install Express framework, encountered some problems, but finally installed successfully, the following is the procedure

1.node JS Installation

Visit Nodejs website to download the installation package on the Mac, download here can choose Mac Installer pkg installation package, download directly click on the installation, of course, you can also choose binary package for installation, download and then use the TAR-ZXVF command to unpack and then edit In the installation. The new version of the installer will install NPM (Nodejs's package management tool) and test if the installation is successful.

Use Node-v and npm-v to view the respective version information, if the node command can not find the first to use the which node command to see the installation directory, and then you can use the

Second, you can follow the Nodejs homepage to provide the demo JS script, write a Hello World program, and then visit in the browser to see if OK, to here Node JS installation is complete

2.express Installation

Express is a framework for node JS, which provides many components that facilitate the rapid development of Nodejs. This is similar to some quick frameworks for other languages, PHP Yii,yp, SSH in Java.

When installing Express, you can also refer to the Getting started step of the Express website to install, but I follow this is not installed up.

Now the latest Express version is more than 4.0, express4.0 later version of the Express command line tool from the Express Library separated out (Https://github.com/expressjs/generator) , the way it was installed also changed. has been used before

NPM Istall-g Express

This command tool installs and displays success, but the command line cannot be used for express.

Now for a global installation, choose whether to install globally, depending on your needs. The command is as follows

Install

When the express command-line tool above is installed, you can install the Express framework

cd/var/www/&& CD Test// Install Express frame relies on install//  Start test this project NPM start

Do not use node app.js this way when it is started here, you can use the VIM command to see the contents of the Package.json file in the test directory, where scripts line is found

Then visit http://localhost:3000, you can see Welcome Express!!!

Here we go.

Nodejs Express installation on Mac

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.