nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.44k stars 276 forks source link

existssync returning false true #4429

Closed eTech-Source closed 4 days ago

eTech-Source commented 5 days ago

Version

v22.3.0

Platform

Darwin Ethans-MacBook-Pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64

Subsystem

node:fs

What steps will reproduce the bug?

if (!fs.existsSync(".fs")) {
      fs.mkdirSync(".fs");
      console.info("No cache found. Creating .fs");
    }

How often does it reproduce? Is there a required condition?

It occurred for me after using git to remove and cache it.

What is the expected behavior? Why is that the expected behavior?

Should return false as there is no dir named .fs

What do you see instead?

True is returned. To get more info I consoled fs.stat and this was the result:

Stats { dev: 16777232, mode: 33188, nlink: 1, uid: 501, gid: 20, rdev: 0, blksize: 4096, ino: 52057046, size: 60, blocks: 8, atimeMs: 1719445593768.046, mtimeMs: 1719445593768.1392, ctimeMs: 1719445593768.1392, birthtimeMs: 1719445593768.046 } It seems Node still thinks the dir and file exist on my system.

Additional information

No response

RedYetiDev commented 4 days ago

It's possible the .fs file exists, but isn't visible, as . prefixes files (on MacOS) are hidden by default.

RedYetiDev commented 4 days ago

wrong repo applied, once a collaborator sees it, they will transfer this to nodejs/help