0
0

Node.js v22.5.0でCIのnpmが動作しないバグが発生中

Posted at

TL;DR

  • Node.js v22.5.0にはバグがある
  • CIで使われるnpmのclean-installコマンドが失敗することがある
  • v22.5.1がリリースされるまではv22.4系へのダウングレードを推奨

経緯

2024年7月18日、私のNode.jsを使ったプロジェクトがCloudflareでのビルドに失敗していることに気づきました。

Installing project dependencies: npm clean-install --progress=false
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error   <https://github.com/npm/cli/issues>
npm error A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2024-07-18T17_33_24_424Z-debug-0.log

npmのIssueを調べたところ、同様の報告が複数上がっていました。もっとも詳しい情報が集まっているのは、以下のIssueです。

これによると、問題のバグはNode.js v22.5.0にて発生する一方で、v22.4.1では発生しないようです。また、必ずしもエラーが発生するわけではなく、大量のファイルを扱おうとしたときに発生するとのことです。

npm側ではなく、Node.jsのfs.closeSync()にV8 Fast APIを追加したことがバグの原因とみられています。現在、問題を修正するためのPull Requestが提出されています。

対応策

問題が修正されるまでは、Node.jsのバージョンを一時的にv22.4.1にダウングレードすることが推奨されます。Node.jsの公式X(旧Twitter)アカウントは、すべてのユーザーに対して一時的なダウングレードを呼びかけています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0