1 下载
在官网下载相应对应操作系统的安装程序,下载地址请点击。
2 安装
这里以 windows 操作系统为例,双击安装包:

一路 Next,最后点击 install。
安装成功后,可以在命令行,执行以下命令,检测 Node 与 NPM 工具是否安装成功:
node -v
npm -v
输出结果:

3 简单示例
在 WebStorm 中,编写一段 js 代码:
var http = require('http');
http.createServer(function (req,res) {
res.writeHead(200,{'Content-type':'text/plain'})
res.end('Hello,Node World');
}).listen(1333,'127.0.0.1');
console.log("web 服务已启动");
配置一个 Node.js 容器:

运行结果:
web 服务已启动
打开浏览器,输入 http://127.0.0.1:1333/,将会看到
Hello,Node World
是不是很简单呀 O(∩_∩)O哈哈~
网友评论