我正在打包要部署在服务器上的节点应用程序,而不使用npm。我相信我已经想通了 - 我使用npm根据package.json文件将所有依赖项安装在本地node_modules文件夹中。npm不会构建Contextify发布 - 找不到节点路径?
这一切似乎工作正常,但当我试图从服务器运行节点文件,它抱怨它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
的目录。我认为故宫只是没有内置的发布,所以我切换回dev的机器,跑npm install
- 它并没有抱怨,也出现了建contextify:
$ sudo npm install
> [email protected] 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
文件夹。
所以,我想问题是,如果因为我的节点路径没有设置而导致构建失败(我试过export NODE_PATH
,但它似乎没有帮助...),或者如果还有其他原因这种说法似乎并没有建立。
也许我错过了更大的东西?我也是有同样的问题
增加了一个问题:https://github.com/brianmcd/contextify/issues/3 - 好的呼叫。 – Jesse