美文网首页
Mac下安装Node.js

Mac下安装Node.js

作者: 字母大师 | 来源:发表于2018-03-15 16:23 被阅读0次

第一步https://nodejs.org/en/下载软件按照提示安装 874057AE2C5D92186EA5FED99FA64DD7.jpg

第二步

打开终端 输入 npm -v 和 node -v 查看

第三步

创建js文件

var http = require("http");

http.createServer(function(request, response) {
    response.writeHead(200, {
        "Content-Type" : "text/html"
    });
    response.write("hello World");
    response.end("hello World");
}).listen(8000, "127.0.0.1");

console.log("Creat server on http://127.0.0.1:8000/");

运行
浏览器输入

http://127.0.0.1:8000/

相关文章

网友评论

      本文标题:Mac下安装Node.js

      本文链接:https://www.haomeiwen.com/subject/uvphqftx.html