npmのアップデートでエラー?
TypeScriptをインストールしようとしたらnpmの最新版があります!とのメッセージ。
現在のNode.jsバージョンはv20.13.1
公式 https://nodejs.org/ja よりNode.js(LTS)をダウンロードしました。
現在のLTSはv22.15.0です。
インストール後にNode.jsのバージョンを確認。
v22.15.0にアップデートできました。
※最新版にアップデートしたいのでバージョン指定"@11.3.0"はしませんでした。
PS C:\Users\xxx> npm install typescript -g changed 1 package in 3s npm notice npm notice New major version of npm available! 10.5.2 -> 11.3.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0 npm notice Run npm install -g npm@11.3.0 to update! npm noticeで、言われた通りに実行したらエラー
PS C:\Users\xxx> npm install -g npm@11.3.0
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: npm@11.3.0
npm ERR! notsup Not compatible with your version of node/npm: npm@11.3.0
npm ERR! notsup Required: {"node":"^20.17.0 || >=22.9.0"}
npm ERR! notsup Actual: {"npm":"10.5.2","node":"v20.13.1"}
npm ERR! A complete log of this run can be found in: C:\Users\xxx\AppData\Local\npm-cache\_logs\2025-04-25T07_28_41_525Z-debug-0.log
これは Node.jsのバージョンが古く、最新のnpm@11.3.0に対応していないため、のようです。現在のNode.jsバージョンはv20.13.1
PS C:\Users\xxx> node -v v20.13.1Node.jsを最新にするには、最新版をダウンロードしてインストール、という手順のようです。
公式 https://nodejs.org/ja よりNode.js(LTS)をダウンロードしました。
現在のLTSはv22.15.0です。
インストール後にNode.jsのバージョンを確認。
v22.15.0にアップデートできました。
PS C:\Users\xxx> node -v
v22.15.0
では、あらためてnpmのアップデート※最新版にアップデートしたいのでバージョン指定"@11.3.0"はしませんでした。
PS C:\Users\xxx> npm install -g npm
removed 33 packages, and changed 106 packages in 4s
25 packages are looking for funding
run `npm fund` for details
バージョン確認
PS C:\Users\xxx> npm -v
11.3.0
最新版にアップデートできました。
Node.js, npm
0 件のコメント:
コメントを投稿