LoginSignup
sui1111
@sui1111 (su i)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Node-redのノードの追加のエラーの解決方法

解決したいこと

 Node-RED上で、「メニュー > パレットの管理 > ノードの追加」から「node-red-contrib-teachable-machine」ノードを追加しようとしましたが、次のエラーが表示されます。

「追加処理が失敗しました: node-red-contrib-teachable-machine Install failed。詳細はログを確認してください。」

また、ユーザーディレクトリで「npm install node-red-contrib-teachable-machine」を実行してみても、下記に書いてある通りエラーメッセージが表示されます。

お手数ですが、この問題の解決策についてご教授いただけますと幸いです。
追記:他の画像認識系のノード(node-red-contrib-tensorflow)でもエラーが起きます。

発生している問題・エラーコード

C:\Users\Owner\.node-red>npm install node-red-contrib-teachable-machine
npm WARN deprecated npmlog@5.0.1: This package is no longer supported.
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated are-we-there-yet@2.0.0: This package is no longer supported.
npm WARN deprecated gauge@3.0.2: This package is no longer supported.
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@tensorflow\\tfjs-backend-webgl',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-backend-webgl\dist'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@tensorflow\\tfjs-backend-webgl\\dist'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-backend-webgl\dist'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@tensorflow\\tfjs-backend-webgl\\dist'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@mapbox\node-pre-gyp\node_modules\https-proxy-agent'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@mapbox\\node-pre-gyp\\node_modules\\https-proxy-agent'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@mapbox',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@mapbox\node-pre-gyp\lib'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@mapbox\\node-pre-gyp\\lib'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@mapbox'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@mapbox'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-node
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! CPU-windows-4.10.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
npm ERR! node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.9
npm ERR! node-pre-gyp info using node@20.13.1 | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" (not found)
npm ERR! node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.10.0/CPU-windows-4.10.0.zip
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.10.0/CPU-windows-4.10.0.zip
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@4.10.0 and node@20.13.1 (node-v115 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.10.0/CPU-windows-4.10.0.zip
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.1.0
npm ERR! gyp info using node@20.13.1 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.1.0
npm ERR! gyp info using node@20.13.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.11.1 found at "C:\Users\Owner\AppData\Local\Programs\Python\Python311\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details.
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS Failure details: undefined
npm ERR! gyp ERR! find VS checking VS2022 (17.2.32630.192) found at:
npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details.
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS Failure details: undefined
npm ERR! gyp ERR! find VS unsupported version "17.2.32630.192" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:116:11)
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:72:17)
npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR! gyp ERR! stack at async createBuildDir (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:95:26)
npm ERR! gyp ERR! stack at async run (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js:81:18)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v8\\tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v8" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=8" "--node_napi_label=napi-v8"
npm ERR! gyp ERR! cwd C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-node
npm ERR! gyp ERR! node -v v20.13.1
npm ERR! gyp ERR! node-gyp -v v10.1.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node --module_name=tfjs_binding --module_path=C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-node\lib\napi-v8 --napi_version=9 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19045
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Owner\\.node-red\\node_modules\\node-red-contrib-teachable-machine\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\Owner\.node-red\node_modules\node-red-contrib-teachable-machine\node_modules\@tensorflow\tfjs-node
npm ERR! node-pre-gyp ERR! node -v v20.13.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9
npm ERR! node-pre-gyp ERR! not ok
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! * Building TensorFlow Node.js bindings

npm ERR! A complete log of this run can be found in: C:\Users\Owner\AppData\Local\npm-cache\_logs\2024-07-22T17_41_35_706Z-debug-0.log

自分で試したこと

ネットの記事で見た「npm config set strict-ssl false」と時刻の設定を更新するのは試しましたが、解決しなかったです。

0

1Answer

エラーメッセージの以下の部分で指摘されています。

npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************

パッケージを追加するにあたって C++ のソースコードのビルドが必要だが、 Visual Studio の Desktop development with C++ ワークロードがインストールされていないためビルドに失敗しているということです。以下の手順に従ってインストールしてください。

0Like

Comments

  1. @sui1111

    Questioner

    Visual C++ ビルド環境をインストールして再度「node-red-contrib-teachable-machine」をインストールしようとしたところ、以下のようなエラーコードが表示されます。

    C:\Users\Owner>npm install node-red-contrib-teachable-machine
    npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
    npm WARN deprecated npmlog@5.0.1: This package is no longer supported.
    npm WARN deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
    npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
    npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
    npm WARN deprecated are-we-there-yet@2.0.0: This package is no longer supported.
    npm WARN deprecated gauge@3.0.2: This package is no longer supported.
    npm ERR! code 1
    npm ERR! path C:\Users\Owner\node_modules\@tensorflow\tfjs-node
    npm ERR! command failed
    npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/install.js
    npm ERR! CPU-windows-4.10.0.zip
    npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
    npm ERR! * Downloading libtensorflow
    npm ERR!
    npm ERR! * Building TensorFlow Node.js bindings
    npm ERR! symlink ./lib/napi-v9 failed:  Error: Command failed: node scripts/deps-stage.js symlink ./lib/napi-v9
    npm ERR!   * Symlink of lib\napi-v9\tensorflow.dll failed, creating a copy on disk.
    npm ERR! node:internal/process/promises:289
    npm ERR!             triggerUncaughtException(err, true /* fromPromise */);
    npm ERR!             ^
    npm ERR!
    npm ERR! [Error: ENOENT: no such file or directory, copyfile 'C:\Users\Owner\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll' -> 'C:\Users\Owner\node_modules\@tensorflow\tfjs-node\lib\napi-v9\tensorflow.dll'] {
    npm ERR!   errno: -4058,
    npm ERR!   code: 'ENOENT',
    npm ERR!   syscall: 'copyfile',
    npm ERR!   path: 'C:\\Users\\Owner\\node_modules\\@tensorflow\\tfjs-node\\deps\\lib\\tensorflow.dll',
    npm ERR!   dest: 'C:\\Users\\Owner\\node_modules\\@tensorflow\\tfjs-node\\lib\\napi-v9\\tensorflow.dll'
    npm ERR! }
    npm ERR!
    npm ERR! Node.js v20.13.1
    npm ERR!
    npm ERR!     at genericNodeError (node:internal/errors:984:15)
    npm ERR!     at wrappedFn (node:internal/errors:538:14)
    npm ERR!     at ChildProcess.exithandler (node:child_process:422:12)
    npm ERR!     at ChildProcess.emit (node:events:519:28)
    npm ERR!     at maybeClose (node:internal/child_process:1105:16)
    npm ERR!     at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
    npm ERR!   code: 1,
    npm ERR!   killed: false,
    npm ERR!   signal: null,
    npm ERR!   cmd: 'node scripts/deps-stage.js symlink ./lib/napi-v9'
    npm ERR! }
    
    npm ERR! A complete log of this run can be found in: C:\Users\Owner\AppData\Local\npm-cache\_logs\2024-07-23T16_20_42_246Z-debug-0.log
    

    以下のエラーメッセージの部分から、「libtensorflow-cpu-windows-x86_64-2.9.1.zip」をインストールすれば解決すると思ったのですが、同じエラーメッセージが再び表示されます。

    npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
    npm ERR! * Downloading libtensorflow
    

    何度も申し訳ございませんが、この問題の解決策をご教授いただけますでしょうか?

  2. C:\Users\Owner>npm install node-red-contrib-teachable-machine
    

    これは C:\Users\Owner\.node-red の中で実行する必要がありそうです。 C:\Users\Owner\node_modules フォルダが作られてしまっているはずなので削除してください。

Your answer might help someone💌