RangeError: Maximum call stack size exceeded when I run the command d2 app scripts init myfirstdhis2app

Hi, I am a DHIS2 beginner creating my first DHIS2 app. However, when I run the command
d2 app scripts init myfirstdhis2app I get this error:
RangeError: Maximum call stack size exceeded
** at Object.existsSync (node:fs:301:20)**
** at findYarnLock (C:\Users\kawis\AppData\Roaming\npm\node_modules@dhis2\cli\node_modules@dhis2\cli-app-scripts\src\lib\paths.js:16:12)**

My d2 version is 4.2.3
My yarn version is 3.5.1

I am a newbie and I have no idea how to solve this. Any help would be appreciated.
Thanks!

Hi @Kishwer_Wali

Welcome to the community!

Please delete the Yarn lock file, and then please make sure that your node.js is the latest recommended version see nodejs.org/en

After that please make sure to install the classic version of yarn : Installation | Yarn

Good luck creating DHIS2 web apps using React! :+1:

I uninstalled yarn(I think that deletes the yarn.lock file). My Node.js version is v18.16.0 and I installed yarn again first with the .msi file then updated it with npm install --global yarn. The error is still there. It won’t let me create the app.

Hi and welcome to the community @Kishwer_Wali ,

You should manually remove the yarn.lock file from your root of the project, uninstalling yarn will not remove this file automatically.

Let me know if that solves the problem!

1 Like