Cannot Build the O3 Reference UI

I’m not sure how to get beyond this. just running the O3 reference application for the sdk. When it attempts to build the UI it get three errors relating to resolving some node modules.


ERROR in ../@openmrs/esm-styleguide/src/modals/index.tsx 19:23-57
Module not found: Error: Can't resolve '@openmrs/esm-extensions' in 'C:\Users\Dale\AppData\Local\npm-cache\_npx\e1faf2b1579efd7d\node_modules\@openmrs\esm-styleguide\src\modals'
 @ ../@openmrs/esm-styleguide/src/public.ts 27:16-35
 @ ../@openmrs/esm-app-shell/node_modules/@openmrs/esm-framework/src/index.ts 15:13-58
 @ consume shared module (default) @openmrs/esm-framework@=5.0.2 (singleton) (fallback: ../@openmrs/esm-app-shell/node_modules/@openmrs/esm-framework/src/index.ts) (eager)
 @ ../@openmrs/esm-app-shell/src/index.ts 21:0-33

Which version of the O3 reference application did you select?

I’ve tried, using the SDK


Reference Application 3.0.0-SNAPSHOT
Reference Application 3.0.0-beta.9

I have got exactly the same errors. I guess this is a result of the ongoing, but not yet completed, update of the frontend to use the new JSON-loading mechanism: Slack

cc @ibacher @dkigen

Yep, we should fix that.

Is there something we can do on the SDK side to mitigate this??

cc: @dkayiwa, @ibacher

I’m still experiencing the same issue. Are you also encountering this error on your end?

cc: @ibacher, @dkayiwa

I am still experiencing the same issue.

We created a way to mitigate this error by allowing users to ignore legacy peer dependencies. Here is the commit for it: SDK-317: Mitigating Module not found error when building the frontend… · openmrs/openmrs-sdk@8e9f5cc · GitHub. If we don’t pass this argument we still get the error. @ibacher can you take a look at this?

cc: @dkayiwa

Oh, is this just legacy peer deps? We absolutely need that flag when using any version of NPM 7 or newer. I don’t see that changing anytime soon, but it’s not a bug. It’s down to a breaking change in NPM 7 that treats peer dependencies differently.

1 Like

Yes. Users can now make the SDK build the frontend with the legacy-peer-deps argument like this:

mvn openmrs-sdk:setup -DignorePeerDependencies= true

Ideally, this would just be the default behaviour… i.e., I’d treat true as the default and let the user set false.

sure, I’ll create a pr for this.

@ibacher, @dkayiwa I created a PR for this: Changing the default value of ignorePeerDependencies to true by wikumChamith · Pull Request #243 · openmrs/openmrs-sdk · GitHub

1 Like

I see a number of people still getting this same exact error even when running versions of npm lower than 7

I wouldn’t’ve thought that --legacy-peer-dependencies would’ve fixed things, really, so that makes some sense. I’ll push out a fix, but it will be for the next SNAPSHOT version.

1 Like

I used --legacy-peer-dependencies as a temporary solution to fix the error and continue working on the SDK. However, this option is not recommended by the npm documentation.

Use of legacy-peer-deps is not recommended, as it will not enforce the peerDependencies contract that meta-dependencies may rely on.

I just noticed that the SDK can build the front end successfully without requiring the legacy-peer-deps flag.