Error on using fs to writeFile json

There was a error when trying to write new data in a json file using fs , I think the file is read only , how to fix that issue

```const db = require("…/util/pikabot.json");
const servers = require("…/util/servers.json");
const users = require("…/util/users.json");
const { RichEmbed } = require(‘discord.js’);
const { writeFile } = require(“fs”); = (client, message, args) => {
let user = users[];
if (user.registered) return message.reply(“You are already registered.”);
let curr = db.defaultCurrencySign;
if ( !== “dm”) {
let serverData = servers[];
if (servers) {
if (servers.currency !== “”) curr = servers.currency;
user.registered = true; += 100;
message.reply(“Registered " + + " and added 100 " + curr + " to account.”);
writeFile(’…/util/users.json’, JSON.stringify(users), (err) => {
if (err) console.error(err);

Make sure the path to your file is correct. A similar issue was opened recently and this answer helped them to resolve it: Discord.js FS Module Broken?

1 Like

The path is correct and I already read that Screenshot_2017-10-30-19-36-52-2
But the issue isn’t being fixed how to change permission of the file and check that there is permission to write on file

From the console (under Advanced Options from the top-left Project Info menu in the editor) ‘ls -la’, which will list the files and their permissions to make sure you have write permission on that file and they haven’t been changed accidentally somehow. But the error ENOENT means that the path is invalid.

1 Like

I have this

As suggested before, I’d address the incorrect path you’re using.

What I don’t get what you replied ?

The first link I provided had the answer, but you can also use the absolute path /app/util/users.json instead of a relative one.

1 Like

It worked thanks for the help You’re really helpful​:+1::sparkling_heart: