Node fs Error: EPERM: operation not allowed, open

I get this error in my application:

Error: EPERM: operation not allowed, open 'C: \ Program Files (x86) \ Full menu \ db \ main.json'

The application I use is built with an electronic template. I use this function to get the path to the root of the application:

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 can I get this to work without running the application as an administrator?

+4
source share
2 answers

; . Everyone , . , readonly ( ).

readonly .

+3
+1

Source: https://habr.com/ru/post/1613677/


All Articles