Hello, i have been getting the error
RangeError: Maximum call stack size exceeded
at Object.existsSync (node:fs:301:20)
at findYarnLock (C:\Users\2.0\AppData\Roaming\npm\node_modules@dhis2\cli\node_modules@dhis2\cli-app-scripts\src\lib\paths.js:16:12)
in window when ever i run the command d2 app scripts init app
Rene
(Rene Pot)
10 July 2023 13:02
2
Hi @Yambanso_Kausiwa , welcome to the community!
Does this topic solve the problem for you?
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 a…
Nope i already tried all the suggestions under that issue but to no avail
iammash
(Reuben Kaponde)
11 July 2023 19:10
4
@Yambanso_Kausiwa did you by any chance manage to resolve this issue? I am facing the same challenge
Rene
(Rene Pot)
12 July 2023 12:28
5
Hi @iammash @Yambanso_Kausiwa
This issue has a pending solution, and there might be a workaround for you to solve this locally until that solution is rolled out.
Here’s a workaround:
Hello @Gassim Thanks for the support steps. However the above steps didn’t work. I had to delete the findYarnLock function in the path.js file under
C:\Users\MY PC\AppData\Local\Yarn\Data\global\node_modules@dhis2\cli-app-scripts\node_modules.
After deleting that function I was able to create my react app successfully.
The pending PR is here:
dhis2:master
← CelsoDeCarvalho:fix/maximum-call-stack-size-exceeded/findYarnLock
opened 10:56AM - 27 Jun 23 UTC
> I was facing this error when I run the d2 app scripts init pmtct to create a n… ew app. Then I found this solution in the CoP: https://community.dhis2.org/t/rangeerror-maximum-call-stack-size-exceeded-error-when-i-run-d2-app-scripts-init-my-app/49023
> But` there we needa delete findYarnLock function. Earlier today, when a was checking this function, I noticed that this function is in an infinite loop on windows systems because the base case inside this function is not verified only in windows.
![dhis2 error](https://github.com/dhis2/app-platform/assets/64174170/2005da07-f635-49c7-bee8-c9fd94bbb38b)
`The line if(base==="/") I think we are checking only for mac or linux OS 'cause in windows, is if(base==="C:\\") .`
![Capture123](https://github.com/dhis2/app-platform/assets/64174170/ac2ed6e2-b145-4b3f-905e-49f423871656)
---
## I tried this solution and it worked for me.
![Capturesdsd](https://github.com/dhis2/app-platform/assets/64174170/8e3748e1-7073-4427-97f5-35ccf9dfb926)
2 Likes
i resolved the issue by copying the yarn.lock file from a collegue. After that when i run the d2 app scripts init appName it worked
2 Likes
Developer
(Muhammad Khurshid)
7 February 2024 08:40
7
I am facing the same issue, could you please share the file atleast
1 Like
Rene
(Rene Pot)
7 February 2024 10:15
8
Hi @Developer , did you update the app platform and CLI?
1 Like