reactjsnode.jsnpmnpm-installnpm-ci

npm ci is failing intermittently with "error cb() never called!" Node@14.16.1 and npm@6.14.12


We have a few build pipelines that are failing intermittently with "error cb() never called!" for npm ci. This error is displayed after it downloaded and extract a random npm package (in case of below log it is date-fns@2.30.0).

We are using "npm ci --loglevel verbose", also before this there is task to run "npm cache verify". The build server has Node@14.16.1 and npm@6.14.12, the same on development environment. We are using a private DevOps Artifacts Feeds for npm packages.

Just for clarification, these build pipelines run successfully sometimes. I tried "npm cache clean --force", also manually cleaned/deleted npm-cache folder of the build server but didn't help.

Anyone encountered with similar situation, please share your experience or input that may help. Thank you in advance.

5222 http fetch GET 200 https://tfs /npm/registry/@progress/kendo-inputs-common/-/kendo-inputs-common-3.1.0.tgz 7027ms
5223 silly extract @progress/kendo-inputs-common@3.1.0 extracted to  \node_modules\@progress\kendo-inputs-common (15868ms)
5224 silly extractTree tslib@2.6.2 ->  \node_modules\@progress\kendo-inputs-common\node_modules\tslib
5225 silly tarball trying tslib@2.6.2 by hash: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
5226 silly tarball no local data for tslib@2.6.2. Extracting by manifest.
5227 http fetch GET 200 https://tfs /npm/registry/react-reconciler/-/react-reconciler-0.26.2.tgz 19480ms
5228 http fetch GET 200 https://tfs /npm/registry/tslib 3150ms
5229 silly extract react-reconciler@0.26.2 extracted to  \node_modules\react-reconciler (270928ms)
5230 http fetch GET 200 https://tfs /npm/registry/tslib/-/tslib-2.6.2.tgz 2475ms
5231 silly extract tslib@2.6.2 extracted to  \node_modules\@progress\kendo-inputs-common\node_modules\tslib (6776ms)
5232 http fetch GET 200 https://tfs /npm/registry/@progress/kendo-theme-default/-/kendo-theme-default-5.12.0.tgz 56505ms
5233 silly extract @progress/kendo-theme-default@5.12.0 extracted to  \node_modules\@progress\kendo-theme-bootstrap\node_modules\@progress\kendo-theme-default (70471ms)
5234 http fetch GET 200 https://tfs /npm/registry/date-fns/-/date-fns-2.30.0.tgz 402958ms
5235 silly extract date-fns@2.30.0 extracted to  \node_modules\date-fns (490761ms)
5236 timing npm Completed in 984617ms
5237 error cb() never called!
5238 error This is an error with npm itself. Please report this error at:
5239 error <https://npm.community>

##[debug]Agent.BuildDirectory= BuildAgent3\_work\405
##[debug]rm -rf  BuildAgent3\_work\405\npm
##[debug]removing directory
##[debug]task result: Failed
##[error]Error: Npm failed with return code: 1
##[debug]Processed: ##vso[task.issue type=error;]Error: Npm failed with return code: 1
##[debug]Processed: ##vso[task.complete result=Failed;]Error: Npm failed with return code: 1
Finishing: npm clean install - XXX.Web

Solution

  • The "cb() never called!" error was due to the mismatch version of the npm packages in package.json and package-lock.json. Mostly, in case where package.json had lower version and package-lock.json had higher version it was throwing error.

    To solve the issue, I have to look for such packages and align the version in both package.json and package-lock.json.

    Also, the npm@8.6.0 validates package and package-lock for such mismatches. It is advisable to use npm@8.6.0 to later.