https://github.com/nodejs/node-gyp/issues/1933
にて報告されているが、node-gypのバージョンが5.0.5または、6.0.0のさいに起きるエラーのようである。
対策としては、node-gypのバージョンを5.0.6または6.0.1に上げることである。
解決方法
バージョンを上げよう。
npm install node-gyp@6.0.1
GitHubActions内でこのエラーが起きた
ただ自分の場合、GitHubActions内で仮想環境を作って、このエラーが起こってしまったため、GithubActions内で参照しているnode-gypのバージョンを変える必要が生じていたのだが、前述したコマンドでは参照バージョンを変更することができなかった。
とりあえず、グローバルにnode-gypを落としてみたものの…
npm install-g node-gyp@6.0.1
ダメ…!
Error output:
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 403 status code downloading arm64 iojs.lib
gyp ERR! stack at Request.<anonymous> (C:\hostedtoolcache\windows\node\12.16.1\x64\node_modules\npm\node_modules\node-gyp\lib\install.js:335:22)
gyp ERR! stack at Request.emit (events.js:323:22)
gyp ERR! stack at Request.onRequestResponse (C:\hostedtoolcache\windows\node\12.16.1\x64\node_modules\npm\node_modules\request\request.js:1066:10)
gyp ERR! stack at ClientRequest.emit (events.js:311:20)
gyp ERR! stack at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:603:27)
gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:476:22)
gyp ERR! stack at TLSSocket.emit (events.js:311:20)
gyp ERR! stack at addChunk (_stream_readable.js:294:12)
gyp ERR! stack at readableAddChunk (_stream_readable.js:275:11)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command"C:\\hostedtoolcache\\windows\\node\\12.16.1\\x64\\node.exe""C:\\hostedtoolcache\\windows\\node\\12.16.1\\x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js""rebuild"
gyp ERR! cwd D:\a\project\project\node_modules\sse4_crc32
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sse4_crc32@6.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
エラー文をよく見たらまだ5.0.5を参照しているようだ。
gyp ERR! node-gyp -v v5.0.5
結局
参照先を動的に変更しました。
run: |
npm install-g node-gyp@6.1.0
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}