Now.js module doesn't work (node path not found)
I'm trying to install the Now.js module for Node.js. It gets installed, but it doesn't work. When I install it, here's what I get:
eustace@eustace-desktop:/var/www/no开发者_开发百科wjs$ sudo npm install now -g
> node-proxy@0.5.1 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)
now@0.7.4 /usr/local/lib/node_modules/now
├── node-proxy@0.5.1
└── socket.io@0.8.2
I'm trying to get the example working (http://nowjs.com/doc/example), but when I run helloworld_server.js in terminal, here's what I get:
eustace@eustace-desktop:/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)
eustace@eustace-desktop:/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)
I'm using Node.js v0.4.11 and Ubuntu 11.04. I tried doing 'export NODE_PATH="/usr/local/lib/node"', but it didn't help. How do I fix this?
The problem was that I mistyped helloworld_server.js. I wasted around 6 hours trying to fix this, what a stupid mistake :)
精彩评论