Skip to content

package.json should have a preinstall script for opencv-build #177

@brcarp

Description

@brcarp

install.js is expecting @u4/opencv-build to be installed, and even though it's listed under dependencies those dependencies haven't necessarily been resolved at the point in time when install.js is run. A solution might be to include a preinstall script like this:

  "scripts": {
    "preinstall": "npm install @u4/opencv-build",
  }

... or more robustly (to avoid an install loop):

  "scripts": {
    "preinstall": "node -e \"try{require('@u4/opencv-build')}catch(e){require('child_process').execSync('npm install @u4/opencv-build')}\""
  }

For my install, installing @u4/opencv-build resolves the gyp error that a lot of other issues are referencing:

gyp: Call to 'node ./bin/install.js OPENCV4NODEJS_DEFINES' returned exit status 1 while in binding.gyp. while trying to load binding.gyp

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