npmなしでサーバーにデプロイするノードアプリのパッケージ化に取り組んでいます。私はそれを理解したと信じています-package.jsonファイルに従って、npmを使用してすべての依存関係をローカルの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 がリリースをビルドしていないだけだと思ったので、dev マシンに切り替えて実行しました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 がビルドに失敗している場合 (試してみexport NODE_PATH
ましたが、役に立たなかったようです...)、または contextify が機能しない他の理由がある場合です。構築しているように見えます。
多分私はもっと大きなものを見逃していますか?