JavaScript File Permissions!

Hello Cookie Tech,

I was wondering if someone could help with a problem I have.

So I need to edit a .json file using a .js file. Now I have done the script to do that:

fs.writeFileSync('../Drivers.json', JSON.stringify('test'))

Now, whenever I run this I get this error:

Error: EPERM: operation not permitted, open '../Drivers.json'
    errno: -4048,
    syscall: 'open',
    code: 'EPERM',
    path: '../Drivers.json'

I tried giving everyone permission via the properties’ security tab, but that didn’t work.

So if you know what I’m doing wrong please tell me thanks!

Are you in a protected folder?

Thanks for the reply,

How do I check?

What folder is it in?

Its in a folder that I created

Which folder is that in? (E.g: “Documents”)

Oh it’s on a secondary drive not the main drive

Try on the main drive and try in the documents folder. C:\Users\Username\Documents.

1 Like

This topic was automatically closed after 7 days. New replies are no longer allowed.