環境
- ホストOS: Windows 10 Pro
- WSL2
- Ubuntu20.04
- Node.js 14.15.1
- npm 6.14.8
状況
wp-envを使うために,
$npm -g install @wordpress/env
すると
ERR! configure error
gyp ERR!
stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 4.19.128-microsoft-standard
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit/build/Release/nodegit.node" "--module_name=nodegit" "--module_path=/usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit/build/Release" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit
gyp ERR! node -v v14.15.1
gyp ERR!
node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR!
build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR!
stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@wordpress/env/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Linux 4.19.128-microsoft-standard
node-pre-gyp
ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/@wordpress/env/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit
node-pre-gyp ERR! node -v v14.15.1
node-pre-gyp
ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/usr/local/lib/node_modules/@wordpress/env/node_modules/nodegit/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
[nodegit] ERROR - Could not finish install
[nodegit] ERROR - finished with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nodegit@0.26.5 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodegit@0.26.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ii-140/.npm/_logs/2020-11-27T06_57_34_623Z-debug.log
解決策
node-pre-gyp
が悪さしてそうなので, そのあたりを調べてると,
WordPress gutenberg の github issueにそれっぽいのがありました.
@watofundefined - Can confirm that I had the same issue, specifically with npm -g i @wordpress/env on a clean copy of Ubuntu 20.04 via Windows 10 WSL2.
sudo apt-get install libkrb5-dev resolved it for me and let the install complete as intended.
Once I closed and reopened terminal wp-env worked as expected.
なるほど,
$sudo apt install libkrb5-dev
したあとに, 再度
$npm -g install @wordpress/env
結果
いけました.