Expand my Community achievements bar.

Get ready! An upgraded Experience League Community experience is coming in January.
SOLVED

Facing Build issues today with Node Modules. Anyone facing the issue

Avatar

Level 3

Hi All,

I am facing some build issues in AEM CS. In local I dont see any error in build. but I am seeing these errors in CloudManager. Can someone help if there are any node upgrades required.

The error

18:21:59,081 [Exec Stream Pumper] [INFO]
18:21:59,081 [Exec Stream Pumper] [INFO] 2025-07-23 18:21:58: webpack 5.100.2 compiled with 64 warnings in 21252 ms
18:21:59,168 [Exec Stream Pumper] [INFO] node:internal/modules/cjs/loader:1002
18:21:59,168 [Exec Stream Pumper] [INFO] throw new ERR_REQUIRE_ESM(filename, true);
18:21:59,168 [Exec Stream Pumper] [INFO] ^
18:21:59,168 [Exec Stream Pumper] [INFO]
18:21:59,168 [Exec Stream Pumper] [INFO] Error [ERR_REQUIRE_ESM]: require() of ES Module /build_root/build/xxxxprogram-p28456/ui.frontend/node_modules/yargs/index.mjs not supported.
18:21:59,168 [Exec Stream Pumper] [INFO] Instead change the require of /build_root/build/xxxxxvprogram-p28456/ui.frontend/node_modules/yargs/index.mjs to a dynamic import() which is available in all CommonJS modules.
18:21:59,168 [Exec Stream Pumper] [INFO] at Object.<anonymous> (/build_root/build/xxxxxxprogram-p28456/ui.frontend/node_modules/aem-clientlib-generator/bin/clientlib-cli.js:8:13) {
18:21:59,168 [Exec Stream Pumper] [INFO] code: 'ERR_REQUIRE_ESM'
18:21:59,168 [Exec Stream Pumper] [INFO] }

1 Accepted Solution

Avatar

Correct answer by
Level 2

It's resolved for us by replacing 

"aem-clientlib-generator": "^1.8.0"

 with 

"aem-clientlib-generator": "1.8.0"

View solution in original post

6 Replies

Avatar

Level 5

Hi @cxasha ,

 

I think you're using require() for an ES Module (yargs), which isn't allowed in Node.js 18+ (used by AEM Cloud Manager). Fix it by replacing require() with import()[import yargs from 'yargs/yargs'] or switching to ESM syntax. Also update aem-clientlib-generator to its latest version to ensure compatibility.

Avatar

Level 3

which files should i update? I have updated aem-clientlib-generator to latest version. I am still seeing the same issue

Avatar

Community Advisor

Hi @cxasha,

Upgrade aem-clientlib-generator

Check your package.json in ui.frontend:

"devDependencies": {
  "aem-clientlib-generator": "^1.8.0"
}

 

npm install aem-clientlib-generator@latest --save-dev

Recent versions of aem-clientlib-generator have switched to support ESM-compatible loading for yargs.

OR

Downgrade yargs to a CommonJS version

If you cannot upgrade aem-clientlib-generator, manually force yargs to a version before 17.0.0, which still supported CommonJS:

npm install yargs@16.2.0 --save-dev

 

"resolutions": {
  "yargs": "16.2.0"
}

 


Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 3

I have updated the yargs but still same issue with  the build

Avatar

Level 2

 

 

We are also facing the same issue. Kindly let us know here if you find the solution.

Avatar

Correct answer by
Level 2

It's resolved for us by replacing 

"aem-clientlib-generator": "^1.8.0"

 with 

"aem-clientlib-generator": "1.8.0"