Facing Build issues today with Node Modules. Anyone facing the issue | Community
Skip to main content
July 23, 2025
Solved

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

  • July 23, 2025
  • 3 replies
  • 1798 views

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] }

Best answer by urvashiagarwal

It's resolved for us by replacing 

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

 with 

"aem-clientlib-generator": "1.8.0"

3 replies

July 23, 2025

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.

cxashaAuthor
July 23, 2025

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

SantoshSai
Community Advisor
Community Advisor
July 23, 2025

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
cxashaAuthor
July 23, 2025

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

July 24, 2025

 

 

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