Error while writing config! TypeError: Cannot read property 'replace' of undefined at stringify (/home/soni/proj/node/netflix-gen/node_modules/jsonfile/index.js:91:14) at Object.writeFileWithCallback (/home/soni/proj/node/netflix-gen/node_modules/jsonfile/index.js:104:11) at Object.writeFileWithCallback [as writeFile] (/home/soni/proj/node/netflix-gen/node_modules/universalify/index.js:5:67) at main (/home/soni/proj/node/netflix-gen/netflix.js:42:18) at processTicksAndRejections (internal/process/task_queues.js:86:5)
Heres the issue I got while doing
jsonfile.writeFile('./myfile.json', data, (fs.existsSync('./myfile.json')) ? { flag: 'a' } : {}, function(err) { if(err) { console.error("Error while writing config!", err); } else { console.log("Saved!"); } });
Error while writing config! TypeError: Cannot read property 'replace' of undefined at stringify (/home/soni/proj/node/netflix-gen/node_modules/jsonfile/index.js:91:14) at Object.writeFileWithCallback (/home/soni/proj/node/netflix-gen/node_modules/jsonfile/index.js:104:11) at Object.writeFileWithCallback [as writeFile] (/home/soni/proj/node/netflix-gen/node_modules/universalify/index.js:5:67) at main (/home/soni/proj/node/netflix-gen/netflix.js:42:18) at processTicksAndRejections (internal/process/task_queues.js:86:5)