I get this error in my app:
Error: EPERM: operation not permitted, open 'C:\Program Files (x86)\Full Menu\db\main.json'
The app I have is built with electron-boilerplate. I am using this function to get the path to the root of the app:
path.dirname(process.execPath)
And this is the script that writes the file:
fs.writeFile(apath + '/db/' + elem + '.json', JSON.stringify(results)
I know what the problem is: permissions. But how could I get this working without running the app as an administrator?
For the benefit of searchers; I has this error. I added full permissions for Everyone
as a test, but that didn't fix it. The issue was that the file was set to readonly
(by source control).
Unchecking the readonly
option in the file properties fixed the issue.