Skip to content

fix(fs-node-to-fsa): stop passing recursive to rmdir() in removeEntry() - #1301

Open
b84330808 wants to merge 1 commit into
streamich:masterfrom
b84330808:fix/node-to-fsa-remove-entry-node-25
Open

b84330808 wants to merge 1 commit into
streamich:masterfrom
b84330808:fix/node-to-fsa-remove-entry-node-25

Conversation

@b84330808

Copy link
Copy Markdown

On Node.js 25 and later, removeEntry() fails for every folder when the adapter wraps the real fs module (nodeToFsa(fs, ...) as in the README):

TypeError [ERR_INVALID_ARG_VALUE]: The property 'options.recursive' is no longer supported. Received false

Node.js 25 moved DEP0147 to end-of-life. fs.rmdir() now throws whenever the recursive option is present, even when it is false. removeEntry() always passed { recursive }.

The existing tests use a memfs volume, which still accepts the option, so CI didn't catch it.

Changes:

  • Recursive removal uses rm(path, { recursive: true }). Non-recursive removal calls rmdir(path) without options, so a non-empty folder still fails with ENOTEMPTY, which maps to InvalidModificationError.
  • New tests run removeEntry() against the real fs in a temp dir: an empty folder, a non-empty folder without recursive, and with recursive. Without the fix they fail on Node.js 26, and they pass on 24 and 26 with it.

I used Claude Code to write this change.

…Entry()`

Node.js 25 removed the `recursive` option of `fs.rmdir()` (DEP0147) and
now throws ERR_INVALID_ARG_VALUE whenever the option is present, even
when it is `false`. `removeEntry()` passed it for every folder, so
removing any folder through `nodeToFsa(fs, ...)` failed on Node.js 25+.

Use `rm(path, { recursive: true })` for recursive removal and plain
`rmdir(path)` otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant