Skip to content

HOME_DIRECTORY passes NaN to fs.existsSync on macOS/Linux #247

Open

Description

@taylortom

On macOS and Linux, HOMEDRIVE and HOMEPATH env vars are undefined. The expression process.env.HOMEDRIVE + process.env.HOMEPATH evaluates to NaN (number), which is then passed to fs.existsSync().

Node 24 deprecated non-string arguments to fs.existsSync (DEP0187), and this triggers a deprecation warning which causes node:test to fail an entire AAT test file.

Location: lib/util/constants.js:17

export const HOME_DIRECTORY = [
  process.env.HOME,
  (process.env.HOMEDRIVE + process.env.HOMEPATH), // ← NaN on non-Windows
  process.env.USERPROFILE,
  '/tmp',
  '/temp'
].filter(fs.existsSync)[0]

Suggested fix: Guard the concatenation and filter out non-string values before calling existsSync.

Activity

  1. changed the title [-]Fix: HOME_DIRECTORY passes NaN to fs.existsSync on macOS/Linux[/-] [+]HOME_DIRECTORY passes NaN to fs.existsSync on macOS/Linux[/+] on Mar 24, 2026
  2. self-assigned this
    on May 22, 2026
  3. added theissue type on Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions