Here is my code:
var fs = require('fs');
var util = require('util');
var logFile = fs.createWriteStream('C:/text.txt', { flags: 'a' });
// Or 'w' to truncate the file every time the process starts.
var logStdout = process.stdout;
console.log = function () {
logFile.write(util.format.apply(null, arguments) + '\n');
logStdout.write(util.format.apply(null, arguments) + '\n');
}
console.error = console.log;
No matter what I type instead of "C:/text.txt" I either get
Error: ENOENT: no such file or directory, open
or
Error: EACCES: permission denied, open
I tried everything such as "run as administrator" and "elevate", but when it's not the second error message, it's the first one; and when it's not the first one, it's the second one.
I'm soooo confused