I have just downloaded LTS node (14.15.0 [npm 6.14.8]) on Windows 10 and I cannot write to file.
If I run the following script anywhere:
var fs = require("fs");
fs.writeFileSync("./test.txt", "hello world", "utf-8");
I get the following error:
[Error: EPERM: operation not permitted, open 'C:\Users\Mehow\Documents\experiments\map-engine\data\moon\test.txt'] {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: C:\\path\\to\\my\\file\\test.txt
I've tried using the async method, I get the same error.
I've checked permissions on the folder, they look fine.
I've run the console as administrator, no change.
Oddly enough, I can make folders easily with a script like this:
fs.mkdirSync(some_directory, {recursive: true});
Anyone have any idea what else I can do?