IBM Support

[Order Hub] Error [ERR_REQUIRE_ESM]: require() of ES Module when creating new application during yarn start-app

Troubleshooting


Problem

To set up Order Hub customization for creating a new application, follow all the steps outlined in the official IBM documentation:  Creating New Applications – IBM Order Management: https://www.ibm.com/docs/en/order-management-sw/10.0.0?topic=hub-creating-new-applications

During the execution of the yarn start-app command, you may encounter the following error:

$ orderhub-cli start-app -c ./app-config.json --with-single-spa --overrides-json overrides.json node:internal/modules/cjs/loader:1074 throw new ERR_REQUIRE_ESM(filename, true); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/suhasphansalkar/Downloads/orderhub-code_25.1.3.0/custom-monorepo/node_modules/@buc/cli/node_modules/yargs/index.mjs not supported. Instead change the require of /Users/suhasphansalkar/Downloads/orderhub-code_25.1.3.0/custom-monorepo/node_modules/@buc/cli/node_modules/yargs/index.mjs to a dynamic import() which is available in all CommonJS modules. at Object.<anonymous> (/Users/suhasphansalkar/Downloads/orderhub-code_25.1.3.0/custom-monorepo/node_modules/@buc/cli/src/cli.js:16:36) { code: 'ERR_REQUIRE_ESM' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 

Symptom

The error encounters when creating new application during yarn start-app. This specific error is encountered only observed on Angular 18 project. 

Cause

The yargs library used by @buc/cli is now ESM-only, but orderhub-cli is trying to require() it as CommonJS, which Node.js (v18) doesn't allow. 

Diagnosing The Problem

Verify the Angular Version. 

Resolving The Problem

(1) The fix for Angular 18 project is to add specific version of yargs in packages.json and install yargs with force:
(a) Open the packages.json file under custom-monorepo and add following:
"resolutions": {
 "yargs": "17.7.2"
}
(b) Install yargs version forcefully:
yarn cache clean
yarn add yargs@17.7.2 -W
(2) The other option is to completely abandon the Angular 18 project and create a fresh project with Angular 15 with node version 16 and then follow all the steps.  So follow this step from the documentation: https://www.ibm.com/docs/en/order-management-sw/10.0.0?topic=hub-creating-new-applications
​Run one of the following commands to reinstall the latest version of @buc/schematics to access the IBM-provided schematics. For Angular v15, run the following command.
npm uninstall -g @buc/schematics
npm install -g ./lib/buc/schematics/schematics-v3latest.tgz

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSGTJF","label":"IBM Sterling Order Management System"},"ARM Category":[{"code":"a8m0z000000cxzaAAA","label":"OrderHub"}],"ARM Case Number":"TS019862044","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":""}]

Product Synonym

oms; orderhub; order hub;

Document Information

Modified date:
21 July 2025

UID

ibm17240127