2011-09-03 60 views
2

我想爲Node.js安裝Now.js模塊。它被安裝,但它不起作用。當我安裝它,這是我得到:Now.js模塊不工作(找不到節點路徑)

[email protected]:/var/www/nowjs$ sudo npm install now -g 

> [email protected] install /usr/local/lib/node_modules/now/node_modules/node-proxy 
> make 

BUILDING: C++ Component 
Checking for program g++ or c++   : /usr/bin/g++ 
Checking for program cpp     : /usr/bin/cpp 
Checking for program ar     : /usr/bin/ar 
Checking for program ranlib    : /usr/bin/ranlib 
Checking for g++       : ok 
Checking for node path     : not found 
Checking for node prefix     : ok /usr/local 
'configure' finished successfully (0.038s) 
Waf: Entering directory `/usr/local/lib/node_modules/now/node_modules/node-proxy/src/build' 
[1/2] cxx: node-proxy.cc -> build/default/node-proxy_1.o 
[2/2] cxx_link: build/default/node-proxy_1.o -> build/default/node-proxy.node 
Waf: Leaving directory `/usr/local/lib/node_modules/now/node_modules/node-proxy/src/build' 
'build' finished successfully (0.909s) 
[email protected] /usr/local/lib/node_modules/now 
├── [email protected] 
└── [email protected] 

我試圖讓例子工作(http://nowjs.com/doc/example),但是當我在終端運行helloworld_server.js,這裏是我得到的:

[email protected]:/var/www/nowjs$ node helloworld_server.s 

node.js:134 
     throw e; // process.nextTick error, or 'error' event on first tick 
     ^
Error: Cannot find module '/var/www/nowjs/helloworld_server.s' 
    at Function._resolveFilename (module.js:317:11) 
    at Function._load (module.js:262:25) 
    at Array.<anonymous> (module.js:421:10) 
    at EventEmitter._tickCallback (node.js:126:26) 
[email protected]:/var/www/nowjs$ node helloworld_server.js 

node.js:134 
     throw e; // process.nextTick error, or 'error' event on first tick 
     ^
Error: Cannot find module 'now' 
    at Function._resolveFilename (module.js:317:11) 
    at Function._load (module.js:262:25) 
    at require (module.js:346:19) 
    at Object.<anonymous> (/var/www/nowjs/helloworld_server.js:7:13) 
    at Module._compile (module.js:402:26) 
    at Object..js (module.js:408:10) 
    at Module.load (module.js:334:31) 
    at Function._load (module.js:293:12) 
    at Array.<anonymous> (module.js:421:10) 
    at EventEmitter._tickCallback (node.js:126:26) 

我使用Node.js v0.4.11和Ubuntu 11.04。我試着做'export NODE_PATH =「/ usr/local/lib/node」',但它沒有幫助。 我該如何解決這個問題?

+1

我會更新的Node.js和他們走。我遇到了一些依賴於node.js 4.0中的socket.io的軟件問題。如果這不是一個選項,您可能需要下載now.js,socket.io等舊版本... – William

+0

我把它更新到v0.5.5,仍然不能正常工作:/ – Eustace

+0

哦,我也得到一個「沒有這樣的環境:發行」的錯誤了。 – Eustace

回答

1

的問題是我輸錯h​​elloworld_server.js。我浪費了6小時左右試圖解決這一問題,有什麼愚蠢的錯誤:)