MAC installation Nodejs

Source: Internet
Author: User

Original link: Http://blog.csdn.net/u010053344/article/details/50545304Mac installation Nodejs

These days because of demand and temporary use to Nodejs, before installing several times, but every time still can't help Baidu under, so this mark under the Mac under the Nodejs installation and testing, to leave a mark for themselves, improve the efficiency of the next.

Step 1:
    • Visit Nodejs website, click on the Blue Marquee area stable, and download https://nodejs.org/en/

Step 2:
    • Double-click the file you just downloaded and follow the steps to install it by default.

Step 3:
    • When the installation is complete, open the terminal, enter
      Npm-v
      Node-v
      Two commands, such as version information, indicate that the installation was successful.

Step 4:
    • Create a new JS file, Nodejstest.js, enter the following code, and save
var HTTP = require ( "http"); Http.createserver (function200, { "Content-type":  "Text/plain"}); Response.Write ( "Welcome to Nodejs"); Response.End ();}). Listen (8000,  "127.0.0.1"); Console.log (  "creat server on Http://127.0.0.1:8000/");        
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • Open terminal into nodejstest.js directory, enter node Nodejstest

    • Open the browser, click or enter Http://127.0.0.1:8000/, if unable to open, you can remove the. Listen (8000, "127.0.0.1") in the IP listener changed to. Listen (8000), then tap or enter http:// Localhost:8000/

MAC installation Nodejs

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.