Skip to content

[BUG] Unable to install "gyp ERR! stack Error: make failed with exit code: 2" #671

@theolop

Description

@theolop

Describe the bug
Unable to install opencv with "npm install opencv".
I have :

theo@iMac-Pro-de-Theo bin % npm i opencv

[email protected] install /usr/local/bin/node_modules/opencv
node-gyp rebuild

CXX(target) Release/obj.target/opencv/src/init.o
../src/init.cc:23:9: warning: Building with OpenCV2.4 [-W#pragma-messages]
#pragma message ( "Building with OpenCV" STR(CV_MAJOR_VERSION) "." STR(CV_MINOR_VERSION) )
^
1 warning generated.
CXX(target) Release/obj.target/opencv/src/Matrix.o
../src/Matrix.cc:136:11: error: no matching member function for call to 'Set'
target->Set(Nan::New("Matrix").ToLocalChecked(), ctor->GetFunction( Nan::GetCurrentContext() ).ToLocalChecked());

/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:228:37: error: no matching member function for call to 'Get'
  mat.setTo(cv::Scalar(scalarObj->Get(0)->IntegerValue( Nan::GetCurrentContext() ).ToChecked(),
                       ~~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:229:20: error: no matching member function for call to 'Get'
      scalarObj->Get(1)->IntegerValue( Nan::GetCurrentContext() ).ToChecked(),
      ~~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:230:20: error: no matching member function for call to 'Get'
      scalarObj->Get(2)->IntegerValue( Nan::GetCurrentContext() ).ToChecked()));
      ~~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:232:37: error: no matching member function for call to 'Get'
  mat.setTo(cv::Scalar(scalarObj->Get(0)->IntegerValue( Nan::GetCurrentContext() ).ToChecked(),
                       ~~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:233:20: error: no matching member function for call to 'Get'
      scalarObj->Get(1)->IntegerValue( Nan::GetCurrentContext() ).ToChecked()));
      ~~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:235:37: error: no matching member function for call to 'Get'
  mat.setTo(cv::Scalar(scalarObj->Get(0)->IntegerValue( Nan::GetCurrentContext() ).ToChecked()));
                       ~~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:308:29: error: no matching member function for call to 'Get'
        (uchar) objColor->Get(0)->IntegerValue( Nan::GetCurrentContext() ).ToChecked();
                ~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:310:29: error: no matching member function for call to 'Get'
        (uchar) objColor->Get(1)->IntegerValue( Nan::GetCurrentContext() ).ToChecked();
                ~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:312:29: error: no matching member function for call to 'Get'
        (uchar) objColor->Get(2)->IntegerValue( Nan::GetCurrentContext() ).ToChecked();
                ~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:314:53: error: no matching member function for call to 'Get'
    self->mat.at<uchar>(y, x) = (uchar) objColor->Get(0)->IntegerValue( Nan::GetCurrentContext() ).ToChecked();
                                        ~~~~~~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                        ^
../src/Matrix.cc:322:12: error: no matching member function for call to 'Set'
    arr->Set(0, Nan::New<Number>(intensity[0]));
    ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:323:12: error: no matching member function for call to 'Set'
    arr->Set(1, Nan::New<Number>(intensity[1]));
    ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:324:12: error: no matching member function for call to 'Set'
    arr->Set(2, Nan::New<Number>(intensity[2]));
    ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:356:10: error: no matching member function for call to 'Set'
  arr->Set(0, Nan::New<Number>((double) pixel.val[0]));
  ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:357:10: error: no matching member function for call to 'Set'
  arr->Set(1, Nan::New<Number>((double) pixel.val[1]));
  ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:358:10: error: no matching member function for call to 'Set'
  arr->Set(2, Nan::New<Number>((double) pixel.val[2]));
  ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:359:10: error: no matching member function for call to 'Set'
  arr->Set(3, Nan::New<Number>((double) pixel.val[3]));
  ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
../src/Matrix.cc:364:10: error: no matching member function for call to 'Set'
  arr->Set(0, Nan::New<Number>((double) pixel.val[0]));
  ~~~~~^~~
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                  ^
/Users/theo/Library/Caches/node-gyp/13.11.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/opencv/src/Matrix.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/Cellar/node/13.11.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/bin/node_modules/opencv
gyp ERR! node -v v13.11.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/usr/local/bin/package.json'
npm WARN bin No description
npm WARN bin No repository field.
npm WARN bin No README data
npm WARN bin No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/theo/.npm/_logs/2020-03-27T21_50_24_196Z-debug.log

To Reproduce
I made a clean uninstall of opencv@2, opencv, pkg-config (brew uninstall) to work
with new packages.

After, I followed the guide by installing for macOS:

brew install pkg-config
brew install opencv@2
brew link --force opencv@2
npm install opencv

Expected behavior
Installation.

OS / Libraries

  • Operating System : macOS catalina 10.15.3
  • OpenCV Version : tested with 2.4 and 4.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions