I am using glitch.com for my private project. I encountered a problem with the file system recently. I’m using fs.writeFile(…) to overwrite a .json file (code below). I’m getting EACCES error message due to permission issues (I assume). My code is written in “time_manipulation.js”
One thing I noticed is that only absolute path for fs.writeFile works (and gave me the error message); all relative path doesn’t do anything from what I see.
My fs code:
fs.writeFile(“/timedroles.json”, JSON.stringify(timedroles), function (err) {
console.log(“added role - fs writeFile”);
if (err)
return console.log(err);
});
To give a sense of how my file directory looks like, I have the following on the “root” directory (as package.json and other default files will give the context):
/
assets
package.json
server.js
time_manipulation.js
timedroles.json
…
This is the error message I see:
Please let me know if any actions will help resolve my problem. My current guess is that I need some kind of “permission” to overwrite my timedroles.json file.
Thank you in advance