npm エラー「npm ERR! notsup Unsupported platform for n@9.2.0: wanted {“os”:”!win32″} (current: {“os”:”win32″})」の解決方法
- 作成日 2023.10.31
- node.js

npmで、「n」インストール時にエラー「npm ERR! notsup Unsupported platform for n@9.2.0: wanted {“os”:”!win32″} (current: {“os”:”win32″})」の解決方法を記述してます。windows環境で発生すると思います。
環境
- OS windows11 home
- node 18.17.0
- npm 9.7.2
エラー全文
「n」パッケージをインストールしようとした以下のコマンドで発生。
> npm install -g n
エラーメッセージ
(node:22496) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@9.2.0: wanted {"os":"!win32"} (current: {"os":"win32"})
npm ERR! notsup Valid os: !win32
npm ERR! notsup Actual os: win32
npm ERR! A complete log of this run can be found in: C:\Users\hoge\scoop\persist\nodejs\cache\_logs\2023-10-31T03_32_57_274Z-debug-0.log
原因
「n」パッケージは、windows環境ではサポートされていないため
対処法
自分は「scoop」で「node」をインストールしているので「scoop」でアップデートしました。
> scoop update nodejs
> node -v
v21.1.0
もちろん公式サイトからインストーラーをダウンロードして、アップデートすることも可能です。

-
前の記事
kotlin Exception「Exception in thread “main” java.util.NoSuchElementException」の解決方法 2023.10.31
-
次の記事
sqlite データに条件を指定して取得する 2023.10.31
コメントを書く