node-opencv: MAC OSX 10.11.6 error

npm install -g opencv

opencv@5.0.0 install /usr/local/lib/node_modules/opencv node-pre-gyp install --fallback-to-build

/usr/local/lib/node_modules/opencv/utils/find-opencv.js:21 throw new Error(“ERROR: failed to run: pkg-config”, opencv, flag); ^

Error: ERROR: failed to run: pkg-config at /usr/local/lib/node_modules/opencv/utils/find-opencv.js:21:23 at ChildProcess.exithandler (child_process.js:213:5) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:877:16) at Socket.<anonymous> (internal/child_process.js:334:11) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at Pipe._handle.close as _onclose gyp: Call to ‘node utils/find-opencv.js --cflags’ returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:305:16) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Darwin 15.6.0 gyp ERR! command “/usr/local/Cellar/node/6.5.0/bin/node” “/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js” “configure” “–fallback-to-build” “–module=/usr/local/lib/node_modules/opencv/build/opencv/v5.0.0/Release/node-v48-darwin-x64/opencv.node” “–module_name=opencv” “–module_path=/usr/local/lib/node_modules/opencv/build/opencv/v5.0.0/Release/node-v48-darwin-x64” gyp ERR! cwd /usr/local/lib/node_modules/opencv gyp ERR! node -v v6.5.0 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute ‘/usr/local/Cellar/node/6.5.0/bin/node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/opencv/build/opencv/v5.0.0/Release/node-v48-darwin-x64/opencv.node --module_name=opencv --module_path=/usr/local/lib/node_modules/opencv/build/opencv/v5.0.0/Release/node-v48-darwin-x64’ (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/opencv/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:106:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) node-pre-gyp ERR! System Darwin 15.6.0 node-pre-gyp ERR! command “/usr/local/Cellar/node/6.5.0/bin/node” “/usr/local/lib/node_modules/opencv/node_modules/.bin/node-pre-gyp” “install” “–fallback-to-build” node-pre-gyp ERR! cwd /usr/local/lib/node_modules/opencv node-pre-gyp ERR! node -v v6.5.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.17 node-pre-gyp ERR! not ok Failed to execute ‘/usr/local/Cellar/node/6.5.0/bin/node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/opencv/build/opencv/v5.0.0/Release/node-v48-darwin-x64/opencv.node --module_name=opencv --module_path=/usr/local/lib/node_modules/opencv/build/opencv/v5.0.0/Release/node-v48-darwin-x64’ (1) npm ERR! Darwin 15.6.0 npm ERR! argv “/usr/local/Cellar/node/6.5.0/bin/node” “/usr/local/bin/npm” “install” “-g” “opencv” npm ERR! node v6.5.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE

npm ERR! opencv@5.0.0 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the opencv@5.0.0 install script ‘node-pre-gyp install --fallback-to-build’. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the opencv package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-pre-gyp install --fallback-to-build npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs opencv npm ERR! Or if that isn’t available, you can get their info via: npm ERR! npm owner ls opencv npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24

Most upvoted comments

Try this solution: brew reinstall pkg-config

Rerun brew link opencv and npm install -g opencv after this.

@hktalent did you try reinstall pkg-config? brew reinstall pkg-config

If not, then try it and after run brew doctor to check if there’s anything that needs to be fixed, then reinstall opencv just to be sure things compile right: brew reinstall opencv.

@gedeagas run brew doctor to fix the permission issues to symlink pkg-config properly.

Anyway, looks like you were able to install node-opencv, and it’s just the module that can’t be loaded now? Why not just install it locally: npm install --save opencv