UrielCh / opencv4nodejs

ESM Nodejs bindings to OpenCV 3/4
MIT License
254 stars 51 forks source link

An error occurred when I executed the npx build-opencv --version 4.6.0 rebuild command,However, it is normal in @u4/opencv4nodejs6.5.2 #136

Open jay-gaojing opened 6 months ago

jay-gaojing commented 6 months ago

image

UrielCh commented 6 months ago

@u4/Opencv-build@1.0.0 is not compatible with V6.

please upgrade to @u4/opencv4nodejs@V7

AlexSmirnov9107 commented 6 months ago

same here

package.json

"dependencies": {

    "@u4/opencv-build": "^1.0.0",
    "@u4/opencv4nodejs": "^7.0.0",

  },
 "opencv4nodejs": {
    "disableAutoBuild": 1,
    "opencvIncludeDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/include/opencv4/",
    "opencvLibDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/lib/",
    "opencvBinDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/bin/"
  }
UrielCh commented 6 months ago

you can remove: "opencvIncludeDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/include/opencv4/", "opencvLibDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/lib/", "opencvBinDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/bin/"

homebrew's openCV is autodetect, on MacOS, that one of the main differences with the original project.

AlexSmirnov9107 commented 6 months ago

you can remove: "opencvIncludeDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/include/opencv4/", "opencvLibDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/lib/", "opencvBinDir": "/opt/homebrew/Cellar/opencv/4.9.0_6/bin/"

homebrew's openCV is autodetect, on MacOS, that one of the main differences with the original project.

did not help

image

info config found opencv4nodejs section in /Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/package.json
info init no_autobuild is set.
info init 
info applyEnvsFromPackageJson the following opencv4nodejs environment variables are set in the package.json:

/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv-build/script/deps/jsr.io/@std/fmt/0.223.0/colors.js:119
        ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
                             ^
TypeError: str.replace is not a function
    at run (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv-build/script/deps/jsr.io/@std/fmt/0.223.0/colors.js:119:30)
    at Object.green (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv-build/script/deps/jsr.io/@std/fmt/0.223.0/colors.js:210:12)
    at formatNumber (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv-build/script/src/utils.js:67:43)
    at /Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv-build/script/src/OpenCVBuildEnv.js:396:161
    at Array.forEach (<anonymous>)
    at new OpenCVBuildEnv (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv-build/script/src/OpenCVBuildEnv.js:396:21)
    at new OpenCVBuilder (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv-build/script/src/OpenCVBuilder.js:75:24)
    at getOpenCV (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv4nodejs/cjs/lib/cvloader.js:40:21)
    at loadOpenCV (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv4nodejs/cjs/lib/opencv4nodejs.js:36:48)
    at Object.<anonymous> (/Users/alexandrsmirnov/Work/lombard-white/nestjs-lombard-terminal/node_modules/@u4/opencv4nodejs/cjs/lib/opencv4nodejs.js:58:14)
AlexSmirnov9107 commented 6 months ago

i've figured out. instead of

  "opencv4nodejs": {
    "disableAutoBuild": 1
  }

i made

    "opencv4nodejs": {
    "disableAutoBuild": "1"
  }

replace number to string

jay-gaojing commented 6 months ago

我已经弄清楚了。 代替

  "opencv4nodejs": {
    "disableAutoBuild": 1
  }

我做了

  "opencv4nodejs": {
  "disableAutoBuild": "1"
}

将数字替换为字符串

I tried to do that, but reported other errors image

UrielCh commented 6 months ago

fixed in within @u4/opencv-build@1.0.1 thx for the report