LoginSignup
14
11

More than 1 year has passed since last update.

npm install実行時、 ERR! cb() never called!エラー対処

Last updated at Posted at 2021-05-28

はじめに

npm install時に、以下のエラー文が出たため、エラーとその解決方法を簡潔にまとめました。

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-05-27T13_35_20_732Z-debug.log

原因

cb() never called!を調べてみると、キャッシュの不具合によるものです。

対処

キャッシュを以下のコマンドで削除すると、インストールできます。

方法①

$ npm cache verify
$ npm install

npm cache verifyコマンドは、キャッシュを確認し、不要なデータをガベージコレクションし、キャッシュインデックスとすべてのキャッシュデータの整合性を確認する働きがあります。

※「ガベージコレクション」・・・プログラムが動的に確保したメモリ領域のうち、不要になった領域を自動的に解放する機能

方法②

$ rm -rf node_modules
$ npm cache clean --force
$ npm cache ls
$ rm -rf ~/.npm
$ npm install

//or
$ npm install --no-bin-links

npmcache verifyがだめだった場合、npm cache cleanでうまくいく場合もあります。

また、Windows 環境では、npm install--no-bin-linksをつけるとよいです。

参考

便利なnpmコマンド
npm トラブルシューティング

14
11
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
14
11