Today I tried to create new react app using (create-react-app app-name
) in CMD and this error appeared :
PS C:\Users\ahmed\Desktop\My File\New Folder\New Folder JS\New Folder> create-react-app testing-app
C:\Users\ahmed\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:49
throw err0
^
RangeError: Maximum call stack size exceeded
at Object.mkdirSync (fs.js:738:10) ...
Also, the installation will be stuck if I try to install any package in this folder like prop-type
, I tried to update my node
as well create-react-app
but nothing change. I solved this problem by creating my react app in C:\Users\ahmed
not in C:\Users\ahmed\Desktop\My File\New Folder\New Folder JS\New Folder
So my question is: why I can't create react app in a long path like C:\Users\ahmed\Desktop\My File\New Folder\New Folder JS\New Folder
why it needs to be created in C:\Users \username
?
I find the solution to my problem.
my problem was I tried to creating new react app using npm create-react-app app-name
in CMD
.
If I try to create react in C:\Users\user-name\
it will install all the packages and react app will work. But in my case, I tried to create react in different location C:\Users\user-name\folder\folder\folder
and shows the above error.
I find many solutions most of them tried to edit npmrc
file in C:\Program Files\nodejs\node_modules\npm
, add or delete same confg
in this file. but nothing works !!!
when I create react app the error shows in CMD
but at the same time windows defender show this message
unathorised changes blocked
controlled folder access blocked C:\program\File...\node.exe from making changes to the folder C:\Users\user-name\folder\folder\folder
So, the solution was is to stop windows defender and create-react-app
works in any location. you can stop windows defender by using different methods stop Windows defender. in my case, I stop Real-time protection, you can do that in windows 10:settings > update & Security > windows security > virus & threat protection > virus & threat protection settings > Real-time protection "off"
.
But the best solution is to add node app
as trust app in Windows defender settings or disable controlled folder access, you can do that by following this link Use controlled folder access
Please try to clear npm cache. Using following command.
npm cache clean --force
The above problem can be solved using the following approach:
If you're on windows, turn off windows defender and then retry create-react-app command. Mostly this should work. If the above solution doesn't work go for the next step.
npm cache clean --force
Now, again retry create-react-app command. This worked like magic for me.
I had same problem It comes from windows defender and firewall . So add node.exe to the exceptions for windows defender and firewall and it may work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With