Skip to content

fs.rmSync cannot remove files under chinese-named directory #61067

Description

@Yuchen-Dai

Version

v24.12.0

Platform

Microsoft Windows NT 10.0.22631.0 x64

Subsystem

No response

What steps will reproduce the bug?

  1. Run a PowerShell
  2. Run command mkdir "D:/2025年12月"
  3. Run command "" | Set-Content D:/2025年12月/test.txt
  4. Run
// D:/script.js
const fs = require('fs');
fs.rmSync('2025年12月/test.txt');

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

Every time.
Tested on Windows Node v24.12.0.
Node v22.10.0 does not appear to have this issue.

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

The file should be deleted.

What do you see instead?

The file remains on disk.

Additional information

This seems related to non-Ascii path handling on Windows.

Possibly the same underlying issue as #58759 and , but with a different failure mode (silent no-op instead of crash).

  • When the filename itself contains Chinese characters, rmSync crash without throw.
  • When an absolute path contains Chinese characters, rmSync also crash without throw.
  • When the file is located inside a Chinese-named directory (but the filename is ASCII-only), rmSync is a no-op but does not throw(no deletion).

Related issues:
#58759
#56049

Activity

  1. Renegade334 commented on Dec 15, 2025

    @Renegade334
    Member

    This binding uses std::filesystem, and is indeed a variant of #58759.

  2. added
    fsIssues and PRs related to file-system APIs and the fs module.
    windowsIssues and PRs related to the Windows platform.
    on Dec 15, 2025
  3. mag123c commented on Dec 29, 2025

    @mag123c
    Contributor

    @Renegade334
    I looked at it because I wanted to contribute if possible.

    I tested this on Windows 10 with both v24.12.0 and the latest nightly build (v26.0.0-nightly20251229879b95efea).

    In v24.12.0, fs.rmSync silently fails to delete files when the path contains non-ASCII characters - whether in the directory name or the filename itself.

    In the nightly build, both cases work correctly.

    This issue appears to be fixed by #61108, which also added the test case test-fs-rmSync-special-char.js.

  4. Yuchen-Dai commented on Dec 31, 2025

    @Yuchen-Dai
    Author

    This has been fixed by #61108 .
    Thanks to everyone involved. Closing this issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to file-system APIs and the fs module.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions