javascript - Now.js 模块不工作(找不到 Node 路径)

标签 javascript ubuntu node.js

我正在尝试为 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"',但没有帮助。 我该如何解决这个问题?

最佳答案

问题是我打错了 helloworld_server.js。我浪费了大约 6 个小时试图解决这个问题,多么愚蠢的错误:)

关于javascript - Now.js 模块不工作(找不到 Node 路径),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7295015/

相关文章:

javascript - 如何拦截触摸并对某些元素执行某些自定义操作,而对其他元素执行通常的行为?

python - Ubuntu Cython 编译错误 : command 'x86_64-linux-gnu-gcc' failed with exit status 1

PHP parse_ini_file 和 includes 不工作(Ubuntu 桌面 LAMP)

javascript - 谷歌可视化时间轴图表日期奇怪地少了一个月......我错过了什么?

javascript - 获取用于绘制的图像比 getElementById 更好的方法吗?

javascript - 提示命令语法

python - Django:使用 simple-history 模块我得到 auth_historicaluser 不存在错误

node.js - Https 服务器上的 Node js 段错误

node.js - 无法使用 Sequelize ORM 连接到 AWS RDS

mysql - Node MySQL连接