npm ERR! cb() never called!が発生した場合の対処法

  • 作成日 2020.11.16
  • npm
npm ERR! cb() never called!が発生した場合の対処法

npm ERR! cb() never called!が発生した場合の原因と対処法を記述してます。

環境

  • ubuntu 20.04.1
  • node 10.19.0
  • npm 1614.4

エラー全文

npxコマンドを実行時に発生。

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>
? ERROR Error: Exited with status 1
    at closeArgsToError (/home/mebee/.npm/_npx/180985/lib/node_modules/preact-cli/node_modules/cross-spawn-promise/lib/index.js:20:16)
    at ChildProcess.<anonymous> (/home/mebee/.npm/_npx/180985/lib/node_modules/preact-cli/node_modules/cross-spawn-promise/lib/index.js:76:19)
    at Object.onceWrapper (events.js:286:20)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

原因

おそらく、npmのキャッシュが破損していたため

対処法

以下のコマンドで、不要なデータをガベージします。

sudo npm cache verify

<出力結果>
Cache verified and compressed (~/.npm/_cacache):
Content verified: 199 (2575057 bytes)
Index entries: 302
Finished in 3.579s