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 3 years have passed since last update.

npm installでパッケージのダウンロードが始まらない

Posted at

起こった事象

githubで管理されてるnode.jsで開発されたソースをcloneして、とりあえず動かすために

$ npm install

を実行したが、一向にインストールが進まなかった。ログを見る限りパッケージのDL自体できてなさそう

環境

  • Ubuntu 20.02 (AWS EC2インスタンス)
  • nvmでnode.jsのバージョンを管理

原因

npmの設定を確認したところ、user-configのregistryの値が謎のIPアドレスになっていた。

$ npm config list
; userconfig /home/xxx/.npmrc
registry = "xxx.xx.xxx.xxx"

いつどこで書き換えてしまったのかは不明...

解決策

以下のコマンドでregistryを標準のアドレスに設定し直して解決

$ npm config set registry https://registry.npmjs.org/

.npmrcファイルの中身を空にしてnpm installを再実行でも解決する

備考

proxyの問題で、registryをhttps→httpに変更することで解決することもあるそうです
https://qiita.com/aoi_snow/items/45d6ef03d509fc103ba7

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?