2012-05-16 59 views
0

我按照這些指令( http://nodenode.com/post/1197688151/installing-node-js-on-ubuntu-screencast-tutorialnode.js安裝錯誤require('http');

在Ubuntu上安裝的node.js,我recieving上

我鍵入的最後一個步驟如下錯誤node hello_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。我做錯了什麼......或者更糟糕,愚蠢?

回答

3

你不使用正常的單引號。您有:

require(‘http’); 

它應該是:

require('http'); 
+0

有時候,生活就是這麼容易。感謝您的光臨!令人討厭的是,我只是從博客中複製了代碼。這就是殺了我! – Joseph

+0

只是在等待時間限制 – Joseph

+0

超過3年後的答案......它仍然繼續拯救別人的生命:P謝謝你的回答:) – rajugaadu