使用OpenCV将Node App部署到Heroku:“运行失败:pkg-config”

时间:2016-09-08 08:38:11

标签: node.js opencv heroku

我可以在本地运行使用OpenCV的节点应用程序。但是,当我部署到Heroku时,我得到以下输出:

/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/utils/find-opencv.js:21
remote:        throw new Error("ERROR: failed to run: pkg-config", opencv, flag);
remote:        ^
remote:        
remote:        Error: ERROR: failed to run: pkg-config
remote:        at /tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/utils/find-opencv.js:21:23
remote:        at ChildProcess.exithandler (child_process.js:209:5)
remote:        at emitTwo (events.js:100:13)
remote:        at ChildProcess.emit (events.js:185:7)
remote:        at maybeClose (internal/child_process.js:850:16)
remote:        at Socket.<anonymous> (internal/child_process.js:323:11)
remote:        at emitOne (events.js:90:13)
remote:        at Socket.emit (events.js:182:7)
remote:        at Pipe._onclose (net.js:484:12)
remote:        gyp: Call to 'node utils/find-opencv.js --cflags' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
remote:        gyp ERR! configure error
remote:        gyp ERR! stack Error: `gyp` failed with exit code: 1
remote:        gyp ERR! stack     at ChildProcess.onCpExit (/tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
remote:        gyp ERR! stack     at emitTwo (events.js:100:13)
remote:        gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
remote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
remote:        gyp ERR! System Linux 3.13.0-93-generic
remote:        gyp ERR! command "/tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/bin/node" "/tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/build/opencv/v5.0.0/Release/node-v47-linux-x64/opencv.node" "--module_name=opencv" "--module_path=/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/build/opencv/v5.0.0/Release/node-v47-linux-x64"
remote:        gyp ERR! cwd /tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv
remote:        gyp ERR! node -v v5.11.1
remote:        gyp ERR! node-gyp -v v3.3.1
remote:        gyp ERR! not ok
remote:        node-pre-gyp ERR! build error
remote:        node-pre-gyp ERR! stack Error: Failed to execute '/tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/bin/node /tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/build/opencv/v5.0.0/Release/node-v47-linux-x64/opencv.node --module_name=opencv --module_path=/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/build/opencv/v5.0.0/Release/node-v47-linux-x64' (1)
remote:        node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
remote:        node-pre-gyp ERR! stack     at emitTwo (events.js:100:13)
remote:        node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
remote:        node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:850:16)
remote:        node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
remote:        node-pre-gyp ERR! System Linux 3.13.0-93-generic
remote:        node-pre-gyp ERR! command "/tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/bin/node" "/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
remote:        node-pre-gyp ERR! cwd /tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv
remote:        node-pre-gyp ERR! node -v v5.11.1
remote:        node-pre-gyp ERR! node-pre-gyp -v v0.6.17
remote:        node-pre-gyp ERR! not ok
remote:        Failed to execute '/tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/bin/node /tmp/build_08bb7f4806ec8cd10186606cfecd7919/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/build/opencv/v5.0.0/Release/node-v47-linux-x64/opencv.node --module_name=opencv --module_path=/tmp/build_08bb7f4806ec8cd10186606cfecd7919/node_modules/opencv/build/opencv/v5.0.0/Release/node-v47-linux-x64' (1)

我在我的heroku应用程序中包含了buildpack for OpenCV。但是,我仍然得到同样的错误。任何帮助都会很棒。感谢。

1 个答案:

答案 0 :(得分:0)

所以我想出了我的heroku部署的问题。 将此buildpack与heroku的默认节点buildpack一起使用,即可成功部署opencv节点应用程序。