跳到主要内容
CNode

一分钟node.js

Kkongwu发布于 16 年前最后回复 13 年前
8134990

(本文仅为了测试wp-syntax插件)

Node.JS:
Node.js开源项目致力于提供一套编写高性能并发Web应用的JavaScript框架,完全事件驱动IO,基于V8引擎,很适合中间件和WEB项目开发。

特点:
* 单线程事件模型,简单高效
* 基于活跃的高性能V8引擎
* 社区活跃,组件丰富


安装node.js:

sudo yum install gcc-c++ openssl-devel

wget http://nodejs.org/dist/node-v0.4.0.tar.gz
./configure; make; sudo make install


安装NPM(node的包管理器):

curl http://npmjs.org/install.sh | sh


WhitePaper: http://nodejs.org/strange-loops.pdf

一分钟可以搞定一个自我编程的高性能WebServer
var http = require('http');

http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');

文章图片

查看回复

回复 (8)

A
anonymous#115 年前

您好,请问,我安装运行后,node hello_node.js
屏幕输出 Server running at http://127.0.0.1:8124/
可是,有个很菜的问题,怎么退出啊,我输入不了任何命令了。谢谢!

A
anonymous#315 年前

Node.js(包括openssl、NPM等等)安装好了之后,运行node,总是报错:

axconfig: port 1 not active
axconfig: port 2 not active

麻烦帮忙诊断一下,谢谢。

A
anonymous#415 年前

同楼上一样的错误。

A
anonymous#515 年前

和楼上同样问题,求解!

P
pengchun#615 年前
引用 anonymousNode.js(包括openssl、NPM等等)安装好了之后,运行node,总是报错: <br/ <br/ axconfig: port 1 not active <br/ axconfig:...

没碰到过这样的情况,不过网上有人建议从源码重新编译一下,你可以试试:

sudo apt-get remove --purge node
sudo apt-get clean

然后参考这个:

http://stackoverflow.com/questions/2424346/getting-error-while-running-simple-javascript-using-node-framework

X
xiexinze#813 年前

Ubuntu node-v0.10.10 安装后 总是出现 axconfig: port 1 not active axconfig: port 2 not active

参与回复

登录后即可参与回复。登录