centos node npm

来源:互联网 发布:怎样集中注意力 知乎 编辑:程序博客网 时间:2024/06/01 23:01

yum install -y gcc-c++ make

curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -

yum install nodejs

node -v
npm -v

vim demo_server.js
var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Welcome Node.js’);
}).listen(3001, “127.0.0.1”);
console.log(‘Server running at http://127.0.0.1:3001/‘);

node –debug demo_server.js