运行node.js时出现问题
problem in running node.js
我是node.js的新手。我按照这里的下载和安装说明进行操作。
现在的问题是,当我在我的终端
节点
我得到以下消息
No script was specified.
Usage: node [options] script.js [arguments]
Options:
-v, --version print node's version
--debug[=port] enable remote debugging via given TCP port
without stopping the execution
--debug-brk[=port] as above, but break in script.js and
wait for remote debugger to connect
--v8-options print v8 command line options
--vars print various compiled-in variables
Enviromental variables:
NODE_PATH ':'-separated list of directories
prefixed to the module search path,
require.paths.
NODE_DEBUG Print additional debugging output.
Documentation can be found at http://nodejs.org/api.html or with 'man node'
之后,我尝试了这个例子:
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/');
提示:ReferenceError: console is not defined.
我在谷歌上搜索了一下,发现我没有正确安装nodejs,所以我又安装了一次,但没有成功:(
请帮忙!!
安装手册中的版本太旧。
这样做
wget http://nodejs.org/dist/node-v0.4.6.tar.gz
gunzip node-v0.4.6.tar.gz
tar -xf node-v0.4.6.tar
cd node
./configure
make
sudo make install
顺便说一句,这里有官方的安装说明:https://github.com/joyent/node/wiki/Installation
相关文章:
- node.js应用程序中的async.js问题
- Node.js服务器问题-已添加“/"在浏览器中查找文件时
- 访问Javascript对象-Node.js的作用域问题
- 在Node.js中使用异步模块时出现问题
- Node.js-异步方法调用问题
- Node JS异步承诺.所有问题
- Express/Node的奇怪(缓存)问题
- 从android连接到node.js服务器时出现问题
- Node.js模块问题
- 在Node.js中将数据传递到子路由时出现问题
- node.js+MySQL;JSON结果-回调问题&没有响应客户端
- Node.js/Socket.io适用于除Firefox之外的所有应用程序,这可能是缓存问题
- node.js http服务器并发问题
- 与阿尔伯特·爱因斯坦有node.js问题
- 在node.js中将数组传递到jade模板时出现问题
- Node.js使用Express和Mongoose设置Passport的问题
- 在Node JS中发出GET请求的问题
- node.js for循环在函数调用返回之前进行迭代,从而产生对象问题
- Node.js:异步代码 + js 闭包的问题
- ajax文件上传问题(Node.js、express、jQuery)