node.js安装错误要求(‘;http’;);

node.js安装错误要求(‘;http’;);,http,node.js,ubuntu,ubuntu-11.10,Http,Node.js,Ubuntu,Ubuntu 11.10,我正在Ubuntu上按照以下说明安装node.js( ) 在最后一步中,我收到了以下错误 我键入node hello\u node.js 我的终端机回复 /home/joe/tmp/hello_node/hello_node.js:1 require(‘http’); ^ node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ SyntaxError

我正在Ubuntu上按照以下说明安装node.js( )

在最后一步中,我收到了以下错误

我键入
node hello\u node.js

我的终端机回复

/home/joe/tmp/hello_node/hello_node.js:1
require(‘http’);
    ^

 node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
 SyntaxError: Unexpected token ILLEGAL
     at Module._compile (module.js:427:25)
      at Object..js (module.js:450:10)
  at Module.load (module.js:351:31)
  at Function._load (module.js:310:12)
  at Array.0 (module.js:470:10)
  at EventEmitter._tickCallback (node.js:192:40)

所以,我似乎“需要”http。我做错什么了吗。。。或者更糟,笨蛋?

你没有使用普通的单引号。你有:

require(‘http’);
应该是:

require('http');

你没有使用普通的单引号。你有:

require(‘http’);
应该是:

require('http');

有时生活是如此简单。谢谢你的现场!令人恼火的是,我只是从博客上复制粘贴了代码。这就是我的死因!在回答问题3年多后等待时间限制。。。它仍然在继续拯救某人的生命:P谢谢你的回答:)有时候生活是如此的简单。谢谢你的现场!令人恼火的是,我只是从博客上复制粘贴了代码。这就是我的死因!在回答问题3年多后等待时间限制。。。它仍在继续拯救某人的生命:P谢谢你的回答:)