1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npm install でnpm ERR! code EBADENGINEというエラーが出た時の対処法

1
Posted at

エラー内容

下記コマンドで以下のようなエラーが出た

% npm install -g npm@11.17.0

npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: npm@11.17.0
npm ERR! notsup Not compatible with your version of node/npm: npm@11.17.0
npm ERR! notsup Required: {"node":"^20.17.0 || >=22.9.0"}
npm ERR! notsup Actual:   {"npm":"10.2.3","node":"v20.10.0"}

解消方法

Nodeのバージョンが足りないだけなので、上げていく
まずは現状確認

% node -v
v20.10.0

エラーを見ると22.9.0が範囲内ぽいので、下記コマンドを入力

 % nodebrew install-binary v22.9.0
 % nodebrew use v22.9.0          

nodeの確認を行う

% node -v              
v22.9.0

もう一度、npm installしてみる

% npm install -g npm@11.17.0
removed 64 packages, and changed 112 packages in 6s

15 packages are looking for funding
  run `npm fund` for details

うまくインストールできた

% npm -v                         
11.17.0
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?