我把Ubuntu安装到了虚拟机上

安装指南

创建虚拟机→安装操作系统→确认互联网连接
安装node并运行helloworld

$ sudo apt-get install emacs24

$ sudo install openssh-server
$ initctl restart ssh 

$ sudo apt-get install git curl build-essential libssl-dev
$ git clone https://github.com/creationix/nvm.git ~/.nvm
$ . ~/.nvm/nvm.sh
$ nvm install  v0.10.19

顺带一提,在 ~/.bashrc 文件中,

. ~/.nvm/nvm.sh
nvm use node

添加

确认动作

创建Hello.js

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('hello world\n');
}).listen(50000);
console.log('Server running at 50000');

6b2a3c7b67c9460d6c0283a32af2984e.png

我原本在CentOS7上進行設置,但無論如何都無法運行HelloWorld,所以我轉換到Ubuntu了。
轉換後馬上就成功了。
我在CentOS上花了大約4天努力,但始終無法成功,很失望啊媽媽…

请用中文将以下内容进行转述:
他们今天晚上要一起去看电影。

SSH配置
http://www.server-world.info/query?os=Ubuntu_14.04&p=ssh

使用nvm在Ubuntu 12.04上安装最新的Node.js和npm
http://d.hatena.ne.jp/hosikiti/20130925/1380093487

在 CentOS 上安装 nvm 和 Node.js
参考链接:http://kohkimakimoto.hatenablog.com/entry/2012/11/01/144007

bannerAds