镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fs.symlink "type=junction" Create file soft link error  #40184

Description

@OLEREO

Version

v14.17.5

Platform

Win32NT 10.0.19043.0 Microsoft Windows NT 10.0.19043.0 x64

Subsystem

FS

What steps will reproduce the bug?

If you use fs.symlink under windows, if you don't use UAC, you will get an "operation not permitted" error.
But adding "type=junction" option can eliminate UAC, but only folders can correctly create soft links. The file will also be recognized as a folder, and the created soft link cannot be used.

fs.symlink('C:\\Users\\olereo\\Desktop\\me\\excel_file.xlsx','C:\\Users\\olereo\\Desktop\\me\\excel_file_sl.xlsx','junction',err=>console.log(err))
fs.symlink('C:\\Users\\olereo\\Desktop\\me\\text_file.txt','C:\\Users\\olereo\\Desktop\\me\\text_file_sl.txt','junction',err=>console.log(err))
fs.symlink('C:\\Users\\olereo\\Desktop\\me\\Folders','C:\\Users\\olereo\\Desktop\\me\\Folders_sl','junction',err=>console.log(err))

sc

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

always

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Activity

  1. added
    fsIssues and PRs related to file-system APIs and the fs module.
    windowsIssues and PRs related to the Windows platform.
    on Sep 23, 2021
  2. bzoz commented on Oct 19, 2021

    @bzoz
    Contributor

    NTFS junction points can only point to folders. This is not a bug in Node.js, just a limitation of the OS. I think it should be documented, both in Node and in libuv.

  3. added
    docIssues and PRs related to Node.js documentation.
    on Oct 19, 2021
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

    docIssues and PRs related to Node.js documentation.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