Uncaught ReferenceError: process is not defined , while the Ui freezes on using D2 react-app

After the yarn start command, the app run and freezes the UI, and display the above errors,
We have inspected the problem and got the following solution that was caused by react-scripts, so

  1. We upgrade react-script into v5.0.0
  2. We install react-error-overlay v6.0.9
  3. We add "resolutions": { "react-error-overlay": "6.0.9" } into package.json, Then delete your yarn.lock or package-lock.json, then install your dependencies again.
    After those setups, the app running well so is there any recommendation for this solution in the D2 ecosystem.
5 Likes

Hello @Danford_David

I was able to perform the suggested steps when I got this error, and it works for the initial app load but I’m still getting the error when the app hot reloads or when the app encounters an exception. Is there a workaround to solve this?

1 Like

Hello @nnkogift, I experienced the same issue on hot reloading the app, This has something to do with the D2 react script itself I think.

1 Like

Hey @Danford_David - thank you for reporting this issue and sorry for the late reply. We (the DHIS2 team) have also recently encountered this issue for one of our apps and found that it was resolved by using the resolution you suggested ( "resolutions": { "react-error-overlay": "6.0.9" }).

One reason why you may still be encountering this issue might be due to using react-scripts v5 (instead of v4). If you’d like to continue to use react-scripts v5, @dhis2/cli-app-scripts version 8.3.3-beta.1 may work better as it depends on that version directly.

@nnkogift @Danford_David if even using @dhis2/cli-app-scripts version 8.3.3-beta.1 does not solve the issue I’d be more than happy to review your yarn.lock/package-lock.json files and try to find the root issue.

5 Likes

Hello @mediremi. Thanks for the solution. I removed the react-scripts v5 package and it worked!

2 Likes

Hello @mediremi, Thanks for your inputs and solution, We will updates the changes in our apps accordingly

1 Like