Issues running new DHIS2 App

When I run yarn start on my newly created app i get this error

C:\DHIS2\dhis-app>yarn start
yarn run v1.22.22
$ d2-app-scripts start
Generating internationalization strings…
No i18n updates found!
Bootstrapping local appShell…
A local appShell exists, skipping bootstrap. Use --force to update.
Building app dhis-app…
Generating manifests…

Starting development server…
The app dhis-app is now available on port 3000

node:internal/modules/cjs/loader:1147
throw err;
^

Error: Cannot find module ‘C:\Dama\DHIS2\dhis-app\react-scripts\bin\react-scripts.js’
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: ‘MODULE_NOT_FOUND’,
requireStack:
}

Node.js v20.11.1
error Command failed with exit code 1.
node:events:496
throw er; // Unhandled ‘error’ event
^

Error: spawn yarn ENOENT
at notFoundError (C:\Dama\DHIS2\dhis-app\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Dama\DHIS2\dhis-app\node_modules\cross-spawn\lib\enoent.js:40:16)
at cp.emit (C:\Dama\DHIS2\dhis-app\node_modules\cross-spawn\lib\enoent.js:27:25)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)
Emitted ‘error’ event on ChildProcess instance at:
at cp.emit (C:\Dama\DHIS2\dhis-app\node_modules\cross-spawn\lib\enoent.js:30:37)
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
code: ‘ENOENT’,
errno: ‘ENOENT’,
syscall: ‘spawn yarn’,
path: ‘yarn’,
spawnargs: [ ‘run’, ‘start’ ]
}

Node.js v20.11.1
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.

C:\DHIS2\dhis-app>

Hi @Tamnjong_Larry_Tabeh

Please check that you are giving access to this folder and file. It looks like an authority issue here, you might want to run on a privileged terminal.

Hi @Gassim thanks for your response even when I run the terminal with administrator privileges I still get this error.

Hello @Tamnjong_Larry_Tabeh

I suggest you use a lower version of Node (18.x or 16.x). I think that may be what’s causing the issue.

1 Like

Hi @nnkogift thanks,
I have tried with both node 16 and 18 and it still gives the same error.

@Gassim and @nnkogift, just to provide more context:

Initially, I faced this issue when creating the app. I resolved it by deleting the findYarnLock function in the paths.js file because I couldn’t locate the Yarn lock file to delete, as suggested in the issue by @Gassim.

However, now I’m encountering this issue that we’re currently trying to solve when running the app.

1 Like

Perhaps you can also try to manually install react scripts by running;

yarn add react-scripts
1 Like

It’s possible that there’s an environment issue causing this error, are you using Windows? If so, please give this option a try and see if it helps: Develop your DHIS2 Web Apps in WSL Environment

Hi @Gassim ,
Thanks a lot! Installing it on WSL worked perfectly. Could you point me to a resource where I can understand in detail the differences between the web apps and the cluster, specifically the app that runs on port 3000 and the one that runs on port 8080?

Thanks!

Hi @Tamnjong_Larry_Tabeh

Great, could we mark that post as a solution to the main topic post?

Clusters are the dhis2 instances that are running on your system. You can run several clusters with different versions and databases. Each cluster will have to use a unique port (3000,8080,8082…etc)

The web app can connect to more than one cluster at a time, and the point is that you will be able to test on more than one version.