npm-install icon indicating copy to clipboard operation
npm-install copied to clipboard

npm ERR! cb() never called!

Open moltar opened this issue 3 years ago • 7 comments

I know this is not directly under this action's control, but I am raising it here, in case there is some effect.

I'm getting the following error intermittently:

Run bahmutov/npm-install@v1
  with:
running npm-install GitHub Action
trying to restore cached NPM modules
npm cache hit undefined
installing NPM dependencies
npm at "/opt/hostedtoolcache/node/14.17.0/x64/bin/npm"
/opt/hostedtoolcache/node/14.17.0/x64/bin/npm ci
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!     /home/runner/.npm/_logs/2021-06-19T10_45_41_566Z-debug.log
Error: The process '/opt/hostedtoolcache/node/14.17.0/x64/bin/npm' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/bahmutov/npm-install/v1/dist/index.js:969:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/bahmutov/npm-install/v1/dist/index.js:952:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/bahmutov/npm-install/v1/dist/index.js:846:27)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Error: The process '/opt/hostedtoolcache/node/14.17.0/x64/bin/npm' failed with exit code 1

Any clues?

moltar avatar Jun 19 '21 11:06 moltar

This sounds more like an issue with your dependencies, something doesn't appear to like version 14.17.0

YenHub avatar Jun 19 '21 23:06 YenHub

It happens in CI only though, and randomly without any pattern.

moltar avatar Jun 19 '21 23:06 moltar

Is your package-lock commited to your repository?

Feel free to share a link and I can take a peek ☺️

YenHub avatar Jun 20 '21 14:06 YenHub

Is your package-lock commited to your repository?

Yeah!

Feel free to share a link and I can take a peek ☺️

It's a private repo :(

But I think I've had it happen on the public ones too, when/if it does, I will share the link here.

Any other debug steps I can take?

moltar avatar Jun 21 '21 02:06 moltar

I get this often as well. Pkg-lock is committed, and occasionally I would get it. Some things to notice, though:

  • Multiple jobs exist in the same workflow, all with the same action, and occasionally one will fail while the other succeed to run npm i.
  • Rerunning the job can often fix the issue
  • It happens after a change in the pkg lock, e.g. upgrading / installing a new package. I think it is related to not properly hitting cache, while other jobs are getting the cache properly. Hope this helps and can shed some light.

Tallyb avatar Jun 23 '21 12:06 Tallyb

Yup what @Tallyb said. Same scenario exactly.

moltar avatar Jun 23 '21 12:06 moltar

This seems to happen when there are multiple jobs running in parallel. My analysis is as follow: Change made to pkg-lock In all jobs, cache hits undefined (since the pkg-lock changed) It installs and tries to create the new cache file. BUT there are multiple jobs that do the same - one succeeds and the others fail, as it already exists

Tallyb avatar Jul 05 '21 09:07 Tallyb