1 Enter the official website, download node's latest version
Official website: https://nodejs.org/en/
2 Double-click the downloaded installation package, all the way to the default installation.
3 Open terminal, enter the following command to view the results, if the message appears, the installation is successful
4 Create a new JS file: Nodetest.js, enter the following code and save
var http = require ("http"); Http.createserver (function(request, response) { Response.writehead ($, { "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/");
5 Open terminal, enter Nodetest.js directory, enter
Node NodeTest
Open Browser, type: 127.0.0.1/8000
If unable to open, you can change the. Listen (8000, "127.0.0.1") to the IP listener to. Listen (8000), and then tap or enter localhost:8000
"Node. js" Mac installs Node text