💡

npm i image --saveでエラーが出たけど諦めた

2023/02/19に公開

結論からいうと、諦めた。

環境はWSL2上の Ubuntu 22.04.2 LTS。nodeは v18.14.1

↓このエラーは apt install libpng-dev で解決出来たが、この後 jpeg側でも同じようなエラーが。 apt install libjpeg-dev で解決しなかったので諦めた。あと、libxml2-dev も試したけどダメだった。

参考
https://stackoverflow.com/questions/32174437/node-gyp-rebuild-fails-while-installing-node-modules

$ npm i image --save
npm ERR! code 1
npm ERR! path /home/noriko/git/nekochan-bounding-box/node_modules/png
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/home/noriko/git/nekochan-bounding-box/node_modules/png/build'
npm ERR!   CXX(target) Release/obj.target/png/src/common.o
npm ERR! make: Leaving directory '/home/noriko/git/nekochan-bounding-box/node_modules/png/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@14.20.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v14.20.1/node-v14.20.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v14.20.1/node-v14.20.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v14.20.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v14.20.1/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/noriko/.nvm/versions/node/v14.20.1/lib/node_modules/npm/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/noriko/git/nekochan-bounding-box/node_modules/png/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/noriko/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/noriko/.cache/node-gyp/14.20.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/noriko/.cache/node-gyp/14.20.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/noriko/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/noriko/.cache/node-gyp/14.20.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/noriko/git/nekochan-bounding-box/node_modules/png',
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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/common.cpp:3:
npm ERR! ../src/common.h:7:5: error: ‘Handle’ in namespace ‘v8’ does not name a template type; did you mean ‘JobHandle’?
npm ERR!     7 | v8::Handle<v8::Value> ErrorException(const char *msg);
npm ERR!       |     ^~~~~~
npm ERR!       |     JobHandle
npm ERR! ../src/common.h:8:5: error: ‘Handle’ in namespace ‘v8’ does not name a template type; did you mean ‘JobHandle’?
npm ERR!     8 | v8::Handle<v8::Value> VException(const char *msg);
npm ERR!       |     ^~~~~~
npm ERR!       |     JobHandle
npm ERR! ../src/common.cpp:7:1: error: ‘Handle’ does not name a type
npm ERR!     7 | Handle<Value>
npm ERR!       | ^~~~~~
npm ERR! ../src/common.cpp:14:1: error: ‘Handle’ does not name a type
npm ERR!    14 | Handle<Value>
npm ERR!       | ^~~~~~
npm ERR! make: *** [png.target.mk:113: Release/obj.target/png/src/common.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/home/noriko/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
npm ERR! gyp ERR! System Linux 5.10.102.1-microsoft-standard-WSL2
npm ERR! gyp ERR! command "/home/noriko/.nvm/versions/node/v14.20.1/bin/node" "/home/noriko/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/noriko/git/nekochan-bounding-box/node_modules/png
npm ERR! gyp ERR! node -v v14.20.1
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/noriko/.npm/_logs/2023-02-19T10_53_02_256Z-debug-0.log

Discussion