0
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?

More than 1 year has passed since last update.

Node.js v18.16.0 npm ERR! code ECONNREFUSED #npm iコマンドがエラーで返ってくる時の対処方法。

Last updated at Posted at 2023-05-02

追記 バージョンダウンしました。 2023年5月18日

Node.js v18.16.0 をバージョンダウンしました。

ネットワーク接続エラーが外でも発生したので
Node.js v18.16.0 が原因ではないと思いました。
そこで、

Windows 環境から Node.js を完全に削除する方法をやってみた | DevelopersIO

を参考にNodeを完全アンインストールして。

node -v
v16.20.0

をインストールしました。

現在の所、エラーが起こった部分は乗り越えましたが、まだ観察中です。

Node 14->18->16と移行したことになります。

追記終了 2023年5月18日

Node.js v18.16.0(推奨版)をインストールしたところ下記のエラーが発生しました。
解決方法がちょっと特殊だったのでメモしておきます。

エラーログ

エラーログ.log
npm i
npm ERR! code ECONNREFUSED
npm ERR! syscall connect
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://registry.npmjs.org/@supabase%2fauth-helpers-nextjs failed, reason: connect ECONNREFUSED 2606:4700::6810:1123:443
npm ERR!     at ClientRequest.<anonymous> (C:\Users\*****\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR!     at ClientRequest.emit (node:events:513:28)
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:502:9)
npm ERR!     at TLSSocket.emit (node:events:525:35)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR!  FetchError: request to https://registry.npmjs.org/@supabase%2fauth-helpers-nextjs failed, reason: connect ECONNREFUSED 2606:4700::6810:1123:443
npm ERR!     at ClientRequest.<anonymous> (C:\Users\hi\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)

環境

Windows10
VSCode
Node.js v14.??.??

※Node.js v14.??.??では npm i は成功していました。

ダウンロード

Node.js

ダウンロード Windows (x64)
18.16.0 LTS
推奨版

再現手順

  1. Node.js v14.??.??をインストールしていた。
  2. バージョンアップするため Node.js v18.16.0 をインストールを実行
  3. npm i を実行
  4. エラーが表示される。

原因

IP アドレスとドメイン名が紐づいてなかった。

解決方法

C:\Windows\System32\drivers\etc\hosts

このファイルを VSCode で開き、下記のように追記します。

104.16.20.35 registry.npmjs.org
104.16.20.35 registry.npmjs.org

npm iを実行すると無事にインストールできました。

参考

npm で ECONNREFUSED とか言われた - Qiita

※この Qiita 記事は Mac の場合の対応方法でした。

0
0
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?