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
原文链接:https://www.f2er.com/centos/376069.html