Skip to content

fs.symlink requires administrator privileges on Windows  #47783

Description

@lqzhgood

Version

20.0.0

Platform

Microsoft Windows NT 10.0.22621.0 x64

Subsystem

No response

What steps will reproduce the bug?

const fs = require("fs");
fs.mkdirSync("i");

fs.symlinkSync("i", "o"); 

if run in non-elevated context cmd.exe throw Error // Error: EPERM: operation not permitted, symlink 'i' -> 'o'

run in elevated context cmd.exe by admin is ok

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

No response

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

fs.symlinkSync run in non-elevated context cmd.exe is ok

mklink does not require administrator privileges to execute on Windows cmd.

What do you see instead?

Error: EPERM: operation not permitted, symlink 'i' -> 'o'`

Additional information

I found this closed issue, but the problem has not been resolved.
#18518

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.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