.d2/shell/src/D2App cant generate a component

new components are not generated in a shell file, i’m working with generating custom reports and i always encountered with this error ```
Module not found: Can’t resolve ‘./D2App/app’ in ‘/home/imsangi/Desktop/ims-custom-reports/.d2/shell/src’

This error always appears once i try to start a project with `yarn start`
can anyone help me please!

Yes, would you like to try yarn run start instead and see if it works? Thank you! (:

And welcome to the community @IDDI_MSANGI, very happy to have you here! And looking forward to hear about the app you’re developing :+1:

Alright, @IDDI_MSANGI may you please run d2 app scripts build --verbose and share if more errors appear? Thank you! (:

1 Like

Okay @Gassim now i’m getting this Error Uncaught (in promise) Error: Cannot get cached sections - PWA is not enabled in d2.config.js

1 Like

Hi @IDDI_MSANGI! I have a few ideas about what might be happening, can you share a few pieces of information?

  1. Is this an app that was initialized using the CLI command d2 app scripts init?
  2. In package.json, what are the versions of @dhis2/app-runtime and @dhis2/cli-app-scripts that the app is using?
  3. What output do you get when you run yarn why @dhis2/app-runtime in the app directory?

Thanks! Hopefully we can help you find a solution :slight_smile:

1 Like

Hi @kpvandivier yes this App was initialized using the CLI command d2 app scripts init i can show you my package.json file

And the Output i get after runinng yarn why @dhis2/app-runtime is


1 Like

Thanks @IDDI_MSANGI! Unfortunately my first idea about the possible issue was not supported :thinking: I was wondering if there were duplicate versions of @dhis2/app-runtime in the dependencies.

Would you mind sharing your code through GitHub so I can check it out and maybe try running it on my computer?

Also, what happens when you press the ‘X’ at the top right of the error screen to close it and go back to the app?

Hi @IDDI_MSANGI I believe I have a resolution for you! The ‘Cannot get cached sections’ error was being thrown in some app-runtime code (that I was responsible for :grimacing:) but it’s fixed now! Upgrading to @dhis2/app-runtime@^3.2.4 should fix the issue for you :slight_smile:

1 Like

Hi @kpvandivier ! Thank you for your responce, After press the ‘X’ at the top right of the error screen to close it, my app running fine but it normally happen i don’t know why?

Okay let me try to update to @dhis2/app-runtime@^3.2.4 then i will let you know. If it wont be fixed i will share it

That error screen is shown by React in development mode (when the app is built and deployed, it wouldn’t show that error in production) – this error was a minor thing in the background that didn’t affect anything else in the app thankfully, so the error screen was shown but the rest of the app could keep working once the screen was closed.

When you update the @dhis2/app-runtime dependency, you might run into something funny where you get errors like Data context must be initialized -- add a DataProvider to your application, and if you run yarn why @dhis2/app-runtime you’ll see there are two versions installed – if that happens, you can fix it by running npx yarn-deduplicate yarn.lock && yarn in your app directory, which will remove the duplicate version which is causing the issue, then sort out the dependencies :slight_smile: Good luck!

1 Like

Thank you @kpvandivier , i’ve understood :relaxed:

1 Like