# Cannot Build the O3 Reference UI

**URL:** <https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959>\
**Category:** Development\
**Tags:** o3\
**Created:** [June 25, 2023, 10:22pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959 "2023-06-25T22:22:26Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![cogitoboy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/cogitoboy/32/18421_2.png) [@cogitoboy](https://talk.openmrs.org/u/cogitoboy)\
**Post date:** [June 25, 2023, 10:22pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/1 "2023-06-25T22:22:26Z")

</div>

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.

```auto

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

```

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [June 26, 2023, 8:08am UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/2 "2023-06-26T08:08:00Z")

</div>

Which version of the O3 reference application did you select?

---

<div class="post-metadata">

**Author:** ![cogitoboy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/cogitoboy/32/18421_2.png) [@cogitoboy](https://talk.openmrs.org/u/cogitoboy)\
**Post date:** [June 26, 2023, 7:03pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/3 "2023-06-26T19:03:25Z")

</div>

I’ve tried, using the SDK

```auto

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

```

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [June 26, 2023, 7:25pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/4 "2023-06-26T19:25:39Z")

</div>

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](https://openmrs.slack.com/archives/CHP5QAE5R/p1687455973397899)

cc @ibacher @dennis

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [June 26, 2023, 8:23pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/5 "2023-06-26T20:23:12Z")

</div>

Yep, we should fix that.

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [June 27, 2023, 2:31am UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/6 "2023-06-27T02:31:17Z")

</div>

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

cc: @dkayiwa, @ibacher

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [July 3, 2023, 7:08pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/7 "2023-07-03T19:08:55Z")

</div>

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

cc: @ibacher, @dkayiwa

---

<div class="post-metadata">

**Author:** ![cogitoboy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/cogitoboy/32/18421_2.png) [@cogitoboy](https://talk.openmrs.org/u/cogitoboy)\
**Post date:** [July 3, 2023, 7:35pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/8 "2023-07-03T19:35:11Z")

</div>

I am still experiencing the same issue.

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [July 27, 2023, 12:08pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/9 "2023-07-27T12:08:13Z")

</div>

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](https://github.com/openmrs/openmrs-sdk/commit/8e9f5cc57f24dc2714f128cf78d3b5569ab34844). If we don’t pass this argument we still get the error. @ibacher can you take a look at this?

cc: @dkayiwa

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [July 27, 2023, 12:17pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/10 "2023-07-27T12:17:10Z")

</div>

> [@wikumc](#):
>
> If we don’t pass this argument we still get the error. @ibacher can you take a look at this?

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.

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [July 27, 2023, 12:22pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/11 "2023-07-27T12:22:40Z")

</div>

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

` mvn openmrs-sdk:setup -DignorePeerDependencies=` `true`

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [July 27, 2023, 12:46pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/12 "2023-07-27T12:46:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [July 27, 2023, 12:53pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/13 "2023-07-27T12:53:09Z")

</div>

sure, I’ll create a pr for this.

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [July 27, 2023, 1:54pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/14 "2023-07-27T13:54:32Z")

</div>

@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](https://github.com/openmrs/openmrs-sdk/pull/243)

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [August 4, 2023, 10:35am UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/15 "2023-08-04T10:35:43Z")

</div>

> [@ibacher](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [August 4, 2023, 6:42pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/16 "2023-08-04T18:42:00Z")

</div>

> [@dkayiwa](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [August 5, 2023, 1:27pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/17 "2023-08-05T13:27:13Z")

</div>

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.

> **[config | npm Docs](https://docs.npmjs.com/cli/v9/using-npm/config/?v=true)**
>
> More than you probably want to know about npm configuration

---

<div class="post-metadata">

**Author:** ![wikumc](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wikumc/32/21813_2.png) [@wikumc](https://talk.openmrs.org/u/wikumc)\
**Post date:** [August 5, 2023, 1:32pm UTC](https://talk.openmrs.org/t/cannot-build-the-o3-reference-ui/39959/18 "2023-08-05T13:32:51Z")

</div>

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