2

TLDR:ノードアプリはローカルで動作しますが、Nodester.comでは動作しません。npmの問題のようです。

詳細バージョン:

bogartとcouchdb(基本的にhttp://howtonode.org/bogart-couchdbをフォロー)を使用してノードアプリを作成しましたが、ローカルで正常に実行されます。

ノード拡張機能をローカルにインストールしました

npm install bogart
npm install couchdb

Nodesterでは、CLIを介してそれらを次のようにインストールしました

nodester npm install bogart couchdb

そしてそれは成功を返しました

今、私は自分の作業コードをNodester.comリポジトリにプッシュし、問題が発生しました。スクリプトがクラッシュし、ログに次のように表示されました。

Error: Cannot find module 'zlib'
at Function._resolveFilename (module.js:322:11)
at Function._load (module.js:267:25)
at require (module.js:351:19)
at Object.<anonymous> (/node_modules/bogart/lib/middleware.js:67:16)
at Function.<anonymous> (/node_modules/bogart/lib/middleware.js:781:15)
at /node_modules/bogart/lib/bogart.js:162:35
at Array.forEach (native)
at App.start (/node_modules/bogart/lib/bogart.js:155:21)
at Object.<anonymous> (/app/server.js:80:5)
at Module._compile (module.js:407:26)

その後、やってみました

nodester npm install zlib

そしてそれは戻った

nodester info installing these npm packages: zlib
nodester > zlib@1.0.5 preinstall /node/app/username/repo/node_modules/zlib
nodester > node-waf clean || true; node-waf configure build
nodester zlib@1.0.5 ./node_modules/zlib 
nodester Nothing to clean (project not configured)
nodester Setting srcdir to                        : /node/app/username/repo/node_modules/zlib 
nodester Setting blddir to                        : /node/app/username/repo/node_modules/zlib/build 
nodester Checking for program g++ or c++          : /usr/bin/g++ 
nodester Checking for program cpp                 : /usr/bin/cpp 
nodester Checking for program ar                  : /usr/bin/ar 
nodester Checking for program ranlib              : /usr/bin/ranlib 
nodester Checking for g++                         : ok  
nodester Checking for node path                   : not found 
nodester Checking for node prefix                 : ok /usr 
nodester Checking for library z                   : yes 
nodester 'configure' finished successfully (0.128s)
nodester Waf: Entering directory `/node/app/username/repo/node_modules/zlib/build'
nodester [1/2] cxx: src/node-zlib.cc -> build/default/src/node-zlib_1.o
nodester ../src/node-zlib.cc: In function 'v8::Handle<v8::Value> ZLib_deflate(const v8::Arguments&)':
nodester ../src/node-zlib.cc:82: warning: left-hand operand of comma has no effect
nodester ../src/node-zlib.cc: In function 'v8::Handle<v8::Value> ZLib_inflate(const v8::Arguments&)':
nodester ../src/node-zlib.cc:83: warning: left-hand operand of comma has no effect
nodester [2/2] cxx_link: build/default/src/node-zlib_1.o -> build/default/zlib_bindings.node
nodester Waf: Leaving directory `/node/app/username/repo/node_modules/zlib/build'
nodester 'build' finished successfully (0.214s)

完全にはインストールされていないようですが、サーバーのクラッシュにより503ではなく起動しているようです。しかし今、スクリプトは

An error occurred.Object # has no method 'createGzip'
Stack Trace:
TypeError: Object # has no method 'createGzip' at /node_modules/bogart/lib/middleware.js:88:33 at notify (/node_modules/bogart/node_modules/promised-io/lib/promise.js:181:22) at notifyAll (/node_modules/bogart/node_modules/promised-io/lib/promise.js:164:5) at /node_modules/bogart/node_modules/promised-io/lib/promise.js:205:3 at notify (/node_modules/bogart/node_modules/promised-io/lib/promise.js:181:22) at [object Object].then (/node_modules/bogart/node_modules/promised-io/lib/promise.js:234:4) at notify (/node_modules/bogart/node_modules/promised-io/lib/promise.js:183:17) at notifyAll (/node_modules/bogart/node_modules/promised-io/lib/promise.js:164:5) at [object Object]. (/node_modules/bogart/node_modules/promised-io/lib/promise.js:211:3) at /node_modules/bogart/lib/middleware.js:347:22

テキストの壁については申し訳ありませんが、これはローカルで問題なく実行され、db接続とすべてのものであるため、ちょっと奇妙です。

https://github.com/devongovett/pdfkit/issues/42で同様の問題

何か案は?

4

1 に答える 1

0

Nodester 開発者の助けを借りて、この問題の修正が現在利用できない理由を説明できるようになりました。

0.6.x より前のバージョンの Node.jsのzlibライブラリは、特定のノード モジュールで (バインディングに関連する) 問題を引き起こすことがあります。これは 0.6 で修正されました。npm 経由で 0.4.x に pdfkit をインストールしようとすると、同様の問題が発生します。

ただし、Nodesterは現在 (2012 年 2 月下旬) 0.4.9 (ish) で動作し、0.6.x 以降のサポートは現在開発中です。これは、Nodester でさまざまなバージョンの Node.js が実行されるまで、bogart が待機する必要があることを意味します。

Nodester の開発者の迅速で広範囲にわたる魅力的なサポートに感謝します。

于 2012-02-25T18:09:23.753 に答える