我正在尝试为Node.js安装Now.js模块。它已安装,但它不起作用。当我安装它时,这就是我得到的:
eustace@eustace-desktop:/var/www/nowjs$ 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
我正在努力让这个例子正常工作(http://nowjs.com/doc/example),但是当我在终端中运行helloworld_server.js时,这就是我得到的:
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)
我正在使用Node.js v0.4.11和Ubuntu 11.04。我试过'export NODE_PATH =“/ usr / local / lib / node”',但它没有帮助。 我该如何解决这个问题?
答案 0 :(得分:1)
问题是我错误输入了helloworld_server.js。我浪费了大约6个小时试图解决这个问题,这是一个愚蠢的错误:)