Closed18
face-api.js for Node.jsのインストールがエラーになるメモ
こちらを参考にインストールしたところ、エラーになったのでメモ。
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ node -v
v14.17.1
$npm -v
7.20.0
ログ
$ npm i face-api.js canvas @tensorflow/tfjs-node
npm ERR! code 1
npm ERR! path /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node
npm ERR! command failed
npm ERR! command sh -c node scripts/install.js
npm ERR! CPU-linux-3.8.0.tar.gz
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.5.0.tar.gz
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.4
npm ERR! node-pre-gyp info using node@14.17.1 | linux | x64
npm ERR! node-pre-gyp info check checked for "/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/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/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@3.8.0 and node@14.17.1 (node-v83 ABI, glibc) (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/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.1 | linux | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.1 | linux | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python2" can be used
npm ERR! gyp ERR! find Python - "python2" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack at PythonFinder.fail (/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/lib/find-python.js:302:47)
npm ERR! gyp ERR! stack at PythonFinder.runChecks (/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/lib/find-python.js:136:21)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/lib/find-python.js:179:16)
npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/lib/find-python.js:266:16)
npm ERR! gyp ERR! stack at exithandler (child_process.js:326:5)
npm ERR! gyp ERR! stack at ChildProcess.errorhandler (child_process.js:338:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:375:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
npm ERR! gyp ERR! stack at onErrorNT (internal/child_process.js:467:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:82:21)
npm ERR! gyp ERR! System Linux 4.4.0-19041-Microsoft
npm ERR! gyp ERR! command "/home/mitsu/.volta/tools/image/node/14.17.1/bin/node" "/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node" "--module_name=tfjs_binding" "--module_path=/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node/lib/napi-v8" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=8" "--node_napi_label=napi-v8"
npm ERR! gyp ERR! cwd /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node
npm ERR! gyp ERR! node -v v14.17.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
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 '/home/mitsu/.volta/tools/image/node/14.17.1/bin/node /home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node --module_name=tfjs_binding --module_path=/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node/lib/napi-v8 --napi_version=8 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (events.js:375:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1055:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! node-pre-gyp ERR! System Linux 4.4.0-19041-Microsoft
npm ERR! node-pre-gyp ERR! command "/home/mitsu/.volta/tools/image/node/14.17.1/bin/node" "/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node
npm ERR! node-pre-gyp ERR! node -v v14.17.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.4
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:
npm ERR! /home/mitsu/.npm/_logs/2021-08-09T05_15_07_061Z-debug.log
memo
おぉ、解決したっぽいIssueコメントが。
→実施しても変わらず。
sudo apt-get install build-essential
npm i node-pre-gyp -g
(if your using tfjs-node-gpu)
npm rebuild @tensorflow/tfjs-node-gpu --build-from-source
(or if your using tfjs-node instead)
npm rebuild @tensorflow/tfjs-node --build-from-source
memo
Raspberry Piでは、注意しないといけないことがあるらしい。
ログをよく見ると、pythonがインストールされてないと出てるので、インストールしてみる。
$ sudo apt update
$ sudo apt install build-essential libbz2-dev libdb-dev \
libreadline-dev libffi-dev libgdbm-dev liblzma-dev \
libncursesw5-dev libsqlite3-dev libssl-dev \
zlib1g-dev uuid-dev tk-dev
$ wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz
$ tar xJF Python-3.9.6.tar.xz
解凍できない
$ tar xJF Python-3.9.6.tar.xz
tar: Cannot use multi-volume compressed archives
$ tar --version
tar (GNU tar) 1.30
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
解凍できた。tarコマンドわからん。
$ tar xJfv Python-3.9.6.tar.xz
$ cd Python-3.x.y
$ ./configure
$ make
$ sudo make install
10分くらいかかりました
Pythonインストール完了
$ python3
Python 3.9.6 (default, Aug 9 2021, 14:49:33)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
リトライ
$ npm i face-api.js canvas @tensorflow/tfjs-node
Python見つからないエラーはなくなった様子。
まだインストールはできず。
$ npm i face-api.js canvas @tensorflow/tfjs-node
npm ERR! code 1
npm ERR! path /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node
npm ERR! command failed
npm ERR! command sh -c node scripts/install.js
npm ERR! CPU-linux-3.8.0.tar.gz
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.5.0.tar.gz
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.4
npm ERR! node-pre-gyp info using node@14.17.1 | linux | x64
npm ERR! node-pre-gyp info check checked for "/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/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/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@3.8.0 and node@14.17.1 (node-v83 ABI, glibc) (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/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.1 | linux | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.6 found at "/usr/local/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v14.17.1/node-v14.17.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v14.17.1/node-v14.17.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v14.17.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v14.17.1/SHASUMS256.txt
npm ERR! gyp info spawn /usr/local/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/mitsu/.cache/node-gyp/14.17.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/mitsu/.cache/node-gyp/14.17.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/mitsu/.volta/tools/image/npm/7.20.0/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/mitsu/.cache/node-gyp/14.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.1 | linux | x64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! gyp info ok
npm ERR! node-pre-gyp ERR! UNCAUGHT EXCEPTION
npm ERR! node-pre-gyp ERR! stack Error: EACCES: permission denied, rename 'build' -> 'build-tmp-napi-v8'
npm ERR! node-pre-gyp ERR! stack at Object.renameSync (fs.js:794:3)
npm ERR! node-pre-gyp ERR! stack at Object.module.exports.swap_build_dir_out (/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@mapbox/node-pre-gyp/lib/util/napi.js:171:8)
npm ERR! node-pre-gyp ERR! stack at /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@mapbox/node-pre-gyp/lib/build.js:25:14
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:91:5)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (events.js:375:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1055:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! node-pre-gyp ERR! System Linux 4.4.0-19041-Microsoft
npm ERR! node-pre-gyp ERR! command "/home/mitsu/.volta/tools/image/node/14.17.1/bin/node" "/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/@tensorflow/tfjs-node
npm ERR! node-pre-gyp ERR! node -v v14.17.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.4
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:
npm ERR! /home/mitsu/.npm/_logs/2021-08-09T05_57_34_083Z-debug.log
気になる
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@3.8.0 and node@14.17.1 (node-v83 ABI, glibc) (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/3.8.0/CPU-linux-3.8.0.tar.gz
npm ERR! node-pre-gyp ERR! stack Error: EACCES: permission denied, rename 'build' -> 'build-tmp-napi-v8'
rootで実行しないといけない...?
ルートユーザーで実行したらインストールできました。
$ sudo su -
$ npm i face-api.js canvas @tensorflow/tfjs-node
別プロジェクトで実行したらエラーになった。泣
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/wrap-ansi
npm ERR! dest /home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.wrap-ansi.DELETE
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/wrap-ansi' -> '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.wrap-ansi.DELETE'
npm ERR! [OperationalError: EACCES: permission denied, rename '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/wrap-ansi' -> '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.wrap-ansi.DELETE'] {
npm ERR! cause: [Error: EACCES: permission denied, rename '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/wrap-ansi' -> '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.wrap-ansi.DELETE'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/wrap-ansi',
npm ERR! dest: '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.wrap-ansi.DELETE'
npm ERR! },
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/wrap-ansi',
npm ERR! dest: '/home/mitsu/ghq/github.com/tmitsuoka0423/nodejs-face-api-js-simple-sample/node_modules/.wrap-ansi.DELETE',
npm ERR! parent: 'nodejs-face-api-js-simple-sample'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-09T12_47_31_885Z-debug.log
このスクラップは2021/08/26にクローズされました