2011-09-03 61 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小时左右试图解决这一问题,有什么愚蠢的错误:)