node.jsangularnpmbootstrap-5loadrunner

The callback was already called for LoaderRunner due to bootstrap version ^3.4.1


Through Azure Build pipeline, I am facing surprising error of The callback was already called in loadrunner.js file. Here is the actual error from pipeline:

C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" run build:prod"
D:\a\31\s\node_modules\loader-runner\lib\LoaderRunner.js:106
            throw new Error("callback(): The callback was already called.");
                  ^
Error: callback(): The callback was already called.
    at context.callback (D:\a\31\s\node_modules\loader-runner\lib\LoaderRunner.js:106:10)
    at D:\a\31\s\node_modules\css-loader\dist\index.js:137:5
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The same checked in set code I had build earlier on January 31, 2023 and it completed build with no issues. Unfortunately at the day of production push, I got the build issue. Since then I am trying to figure out what could be the solution.

Here is the image:

Pipeline error for same set running on different dates

I tried upgrading bootstrap version to 5.0 and above, and it did build successfully but it screwed up my UI. I am using Angular version 9.2.X and bootstrap version is ^3.4.1 in my package.json file.

Someone else posted a similar loadrunner issue on Stack Overflow but the solution provided did not work for me.

Not sure if anything happen to Bootstrap ^3.4.1 working version library? I see that the same library was downloaded 1M+ times on nodejs website in last 7-10 days.

PS: I tried upgrading angular and all the libraries, after that it build successful but upgrading Angular at this time is not an option for me to proceed. What can I try next?

Updating for pipeline info (All jobs has custom command):

Cache Clean:- Task Version 1.*, command: cache clean --force

Npm update:- Task Version 1.*, command: update --force

Npm install:- Task Version 1.*, command: install --legacy-peer-deps --force

Npm build:- Task Version 1.*, command: run build:ps

Thing to note, we have upgraded our angular version from 6 to 9 and since then we have npm update command in pipeline

It passes all steps and fails at npm build


Solution

  • You can try the following (which worked for me) :

    1. Add the "Node.js tool installer" as the first build step in the Agent job which contains your Angular build step. I had to make sure that it was added to the same Agent Job as the Angular build step (and not as part of the "Configure Agent" agent job), otherwise the configuration did not work correctly.

    2. Update the "Version Spec" field of the Node.js tool installer to the version of Node that you know is working locally. (run "node -v" on your local machine's console to check your version) 16.17.0

    3. Also make sure the "Check for Latest Version" is NOT checked

    Hope it helps, this is a very annoying issue.