はじまる

適当な事を適当に書く

Node-RED node-red-contrib-opencv インストールエラー

admin tab からインストールを試みた場合

22 Oct 15:12:54 - [info] モジュールnode-red-contrib-opencv, バージョン: latestをインスートールします
22 Oct 15:13:29 - [warn] モジュール node-red-contrib-opencv のインストールに失敗しました:
22 Oct 15:13:29 - [warn] ------------------------------------------
22 Oct 15:13:29 - [warn]
> opencv@6.0.0 install /Users/me/.node-red/node_modules/opencv
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-opencv.s3.amazonaws.com/opencv/v6.0.0/Release/node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for opencv@6.0.0 and node@8.12.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
(以下略)

コマンドの場合

.node-red ❯ npm install node-red-contrib-opencv

> opencv@6.0.0 install /Users/me/.node-red/node_modules/opencv
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-opencv.s3.amazonaws.com/opencv/v6.0.0/Release/node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for opencv@6.0.0 and node@8.12.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
(以下略)

gyazo.com

あなたどこにいるの...

というかダウンロード元はこっちじゃない?

Releases · peterbraden/node-opencv · GitHub

https://github.com/peterbraden/node-opencv/archive/v6.0.0.tar.gz

node-red-contrib-opencv をみる

https://github.com/zuhito/node-red-contrib-opencv/blob/master/package.jsondependenciesopencv がある。

{
  "name": "node-red-contrib-opencv",
  "version": "0.1.2",
  "description": "Node-RED node for OpenCV",
  "main": "node.js",
  "node-red" : {
    "nodes": {
      "opencv": "node.js"
    }
  },
  "dependencies": {
    "opencv": "*"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/zuhito/node-red-contrib-opencv.git"
  },
  "keywords": [
    "node-red",
    "opencv",
    "image recognition",
    "computer vision"
  ],
  "author": "zuhito",
  "license": "Apache-2.0",
  "bugs": {
    "url": "https://github.com/zuhito/node-red-contrib-opencv/issues"
  },
  "homepage": "https://github.com/zuhito/node-red-contrib-opencv#readme"
}

node-opencv をみる

そもそも npm install opencv でコケる

.node-red ❯ npm install opencv

> opencv@6.0.0 install /Users/me/.node-red/node_modules/opencv
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-opencv.s3.amazonaws.com/opencv/v6.0.0/Release/node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for opencv@6.0.0 and node@8.12.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)

https://github.com/peterbraden/node-opencv/blob/master/package.json#L41

node-opencvpackage.jsonをみてみる。バイナリのダウンロード先は動的に生成しているので、ダウンロード先環境に対応しているバイナリがホストされていないとダメ。

"binary": {
    "module_name": "opencv",
    "module_path": "./build/{module_name}/v{version}/{configuration}/{node_abi}-{platform}-{arch}/",
    "remote_path": "./{module_name}/v{version}/{configuration}/",
    "package_name": "{node_abi}-{platform}-{arch}.tar.gz",
    "host": "https://node-opencv.s3.amazonaws.com"
  }

---------- 終了 -----------