我正在努力打包一个 Node 应用程序,以便在没有 npm 的情况下部署在服务器上。我相信我已经弄清楚了 - 我使用 npm 根据 package.json 文件将所有依赖项安装在本地 node_modules 文件夹中。
一切似乎都运行良好,但是当我尝试从服务器运行 Node 文件时,它会提示 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
- 它没有提示,而且似乎构建了上下文:
$ 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 是否因为我的 Node 路径未设置而无法构建(我试过 export NODE_PATH
,但它似乎没有帮助......),或者是否有其他一些contextify 似乎没有构建的原因。
也许我遗漏了一些更大的东西?
最佳答案
我也遇到了同样的问题,
您可能想将问题添加到 github,作者可能会比在这里更快地帮助您。 https://github.com/brianmcd/contextify/issues?sort=created&direction=desc&state=closed&page=1
关于node.js - npm 不构建 Contextify Release - 找不到 Node 路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7262251/