'Error: ENOENT: no such file or directory, open 'file.json'
i am trying to edit a JSON file in the same dir but i keep getting this error: i tried npm install -g , --save module_name and npm install express
Error: ENOENT: no such file or directory, open 'file.json'
const filename = `file.json`;
const fs = require('fs');
let config = JSON.parse(fs.readFileSync(filename, {encoding: 'utf8'}));
// do your stuff
fs.writeSync(filename, JSON.stringify(config), {encoding: 'utf8'});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
