Skip to content

build fails, seems to be run in wrong directory? #182

Description

@Garfonso

For me install / rebuild fails with this error message:

gyp: binding_old.gyp not found (cwd: /home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs) while trying to load binding_old.gyp

Which makes sense, because in node_modules/@u4/opencv4nodejs/cjs there is no binding.gyp or anything else, that the script searches for. The stuff is in node_modules/@u4/opencv4nodejs, i.e. one dir up.

I have no real clue, why the build fails this way. It's on an Arch based system, maybe that is a clue here?

I had to copy the following files there to make it build:

  • binding.gyp
  • binding_old.gyp
  • bin/instal.js (whole bin folder)

Then had to edit cjs/bin/install.js to not load from ../cjs/install/... but from ../install.

Then I got this error:
gyp: Duplicate target name "opencv4nodejs#target" in directory "." used both in "binding.gyp" and "binding_old.gyp".
So I tried to edit the file binding_old.gyp and change the target (adding _old)...

And now I get this error and don't know what to do (never really understood makefile magic):
make: *** Keine Regel vorhanden, um das Ziel „Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o“, benötigt von „Release/obj.target/opencv4nodejs.node“, zu erstellen. Schluss.

Btw. I'm trying to run: build-opencv --nobuild rebuild from my package root. In the package.json I have the following defines, since opencv is installed in the system and it should use the system opencv:

  "opencv4nodejs": {
    "disableAutoBuild": 1,
    "opencvIncludeDir": "/usr/include/opencv4",
    "opencvLibDir": "/usr/lib",
    "opencvBinDir": "/usr/bin"
  }

Any hints would really be helpful. Thanks. :-)

//Edit: After all this failed tries, I found a build/config.gpy created in my base dir. Is this expected? Is this package not meant to be a dependency of another project? Still lost here...

Full logs

Full log of untampered file:

2025-08-27 09:31:34 Error: install node-gyp failed and return Error Command failed: node-gyp rebuild -f binding_old.gyp --jobs max --release
gyp info it worked if it ends with ok
gyp info using node-gyp@11.4.2
gyp info using node@22.18.0 | linux | x64
gyp info find Python using Python version 3.13.7 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args 'binding_old.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/achim/.cache/node-gyp/22.18.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/achim/.cache/node-gyp/22.18.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/achim/.cache/node-gyp/22.18.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding_old.gyp not found (cwd: /home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs) while trying to load binding_old.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules/node-gyp/lib/configure.js:317:18)
gyp ERR! stack at ChildProcess.emit (node:events:518:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 6.15.8-zen1-2-zen
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" "-f" "binding_old.gyp" "--jobs" "max" "--release"
gyp ERR! cwd /home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs
gyp ERR! node -v v22.18.0
gyp ERR! node-gyp -v v11.4.2
gyp ERR! not ok
return code: 1

Full log of last run:

2025-08-27 09:51:44 Error: install node-gyp failed and return Error Command failed: node-gyp rebuild -f binding_old.gyp --jobs max --release
gyp info it worked if it ends with ok
gyp info using node-gyp@11.4.2
gyp info using node@22.18.0 | linux | x64
gyp info find Python using Python version 3.13.7 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args 'binding_old.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/achim/.cache/node-gyp/22.18.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/achim/.cache/node-gyp/22.18.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/achim/.cache/node-gyp/22.18.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 32 ]
make: *** Keine Regel vorhanden, um das Ziel „Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o“, benötigt von „Release/obj.target/opencv4nodejs.node“, zu erstellen.  Schluss.
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules/node-gyp/lib/build.js:219:23)
gyp ERR! System Linux 6.15.8-zen1-2-zen
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" "-f" "binding_old.gyp" "--jobs" "max" "--release"
gyp ERR! cwd /home/achim/development/pokemonGoController/node_modules/.pnpm/@u4+opencv4nodejs@7.1.2/node_modules/@u4/opencv4nodejs/cjs
gyp ERR! node -v v22.18.0
gyp ERR! node-gyp -v v11.4.2
gyp ERR! not ok
return code: 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions