'EPERM: operation not permitted, stat 'C:\$Recycle.Bin\desktop.ini'

trying to build a react app with vite(npm run build) but this appears. cleaned cashe and reinstalled npm a couple times with vs code closedbut still doesnt work. tried using the command as administator in the terminal but still the error appears and some random files from the C: appeared in the outDir folder like bootmgr (not the real one, it onlt appeard in vs code and deleting it didnt do anything and the real bootmgr is still in C:)

EPERM: operation not permitted, stat 'C:$Recycle.Bin\desktop.ini' error during build: Error: EPERM: operation not permitted, stat 'C:$Recycle.Bin\desktop.ini'
at Object.statSync (node:fs:1551:3) at copyDir (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:2553:34) at copyDir (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:2555:13) at prepareOutDir (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:41439:9) at doBuild (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:41408:13) at async build (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:41244:16) at async CAC. (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\cli.js:738:9)



Solution 1:[1]

the value in the public dir in the vite config was "/src" and it tried to get the value not from the relative location like location/src but C:/src

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1