Update
So, I went to test permissions using fs.access, and everything just started working again. Same console, just a new node repl session.
Not sure why it's working now, but I wish I could have made this post more useful. If I figure out why it happened I'll update this
So, very simply, I am trying to read a file from an absolute path using fs.readFileSync, and even though I can verify the file does in fact exist using my command line, fs.readFileSync throws an error and fs.existsSync returns false.
I'm on windows 8.1 running node v14.8.0.
Line of code in question (snipped for brevity):
//this line is in a constructor, fs, this.filepath, and this.config.fileFormat are all checked and valid
if(!initialContent) initialContent = fs.readFileSync(this.filepath,this.config.fileFormat)
Error produced:
Uncaught:
Error: ENOENT: no such file or directory, open 'C:\Users\ShadowBan\Projects\SS\static\list.txt'
at Object.openSync (fs.js:465:3)
at Object.readFileSync (fs.js:368:35)
at new ListLoader (C:\Users\ShadowBan\Projects\SS\lib\loader.js:57:4
2) {
errno: -4058,
syscall: 'open',
code: 'ENOENT',
path: 'C:\\Users\\ShadowBan\\Projects\\SS\\static\\list.txt'
}
Output of dir on my console:
C:\Users\ShadowBan\Projects\SS>dir static
Volume in drive C is OS
Volume Serial Number is AB75-DE42
Directory of C:\Users\ShadowBan\Projects\SS\static
03/17/2021 02:53 AM <DIR> .
03/17/2021 02:53 AM <DIR> ..
03/13/2021 07:34 PM 6,505 list.txt
2 File(s) 8,477 bytes
2 Dir(s) 3,540,754,432 bytes free