【发布时间】:2011-11-07 21:38:08
【问题描述】:
我正在打包一个节点应用程序以部署在没有 npm 的服务器上。我相信我已经弄清楚了 - 我使用 npm 根据 package.json 文件将所有依赖项安装在本地 node_modules 文件夹中。
看起来一切正常,但是当我尝试从服务器运行节点文件时,它抱怨它Cannot find module '../build/Release/contextify'。
这是有道理的,因为在node_modules/.npm/contextify/0.0.4/package/lib/contextify.js 中,它要求提供有问题的文件,而node_modules/.npm/contextify/0.0.4/package/build 没有名为Release 的目录。我认为 npm 只是没有构建版本,所以我切换回开发机器,然后运行 npm install - 它没有抱怨,它似乎构建了 contextify:
$ sudo npm install
> contextify@0.0.4 preinstall /path/to/node/stuff/node_modules/contextify
> node-waf clean || true; node-waf configure build
'clean' finished successfully (0.014s)
Setting srcdir to : /path/to/node/stuff/node_modules/.npm/contextify/0.0.4/package
Setting blddir to : /path/to/node/stuff/node_modules/.npm/contextify/0.0.4/package/build
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/Cellar/node/0.4.5
'configure' finished successfully (0.043s)
Waf: Entering directory `/path/to/node/stuff/node_modules/.npm/contextify/0.0.4/package/build'
[1/2] cxx: src/contextify.cc -> build/default/src/contextify_1.o
[2/2] cxx_link: build/default/src/contextify_1.o -> build/default/contextify.node
Waf: Leaving directory `/path/to/node/stuff/node_modules/.npm/contextify/0.0.4/package/build'
'build' finished successfully (0.370s)
很遗憾,package/build 目录仍然没有Release 文件夹。
所以,我想问题是 contextify 是否因为我的节点路径未设置而无法构建(我尝试了export NODE_PATH,但它似乎没有帮助......),或者是否有其他contextify 似乎没有构建的原因。
也许我错过了一些更大的东西?
【问题讨论】: