【问题标题】:Running a express server from WSL ( UNC paths are not supported )从 WSL 运行快速服务器(不支持 UNC 路径)
【发布时间】:2023-01-07 01:28:05
【问题描述】:

我正在尝试从 VS Code 中的 WSL 终端运行快速服务器。

但是,每当我运行命令npm run dev时,我都会收到以下错误:

'\\wsl$\Ubuntu\home\simao\legalize-backend'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.

我假设它与从 Windows 到 WSL 目录中的文件夹的路径有关。

哪一种是正确的路径格式,或者我应该怎么做才能使它有效?

搜索我发现你可以

You can solve this problem(UNC Paths not supported) by mapping a 
normal drive letter to the path that has the UNC path.

但是我如何将普通驱动器号映射到路径?

【问题讨论】:

    标签: windows-subsystem-for-linux


    【解决方案1】:

    发生这种情况是因为您使用的任何工具都试图通过 cmd.execmd.exe 运行命令,但不理解 UNC 路径(以 \... 开头而不是驱动器号)。将 UNC 路径映射到驱动器会将其转换为驱动器盘符路径。

    要将 WSL 路径映射到 Windows 驱动器运行 cmd.exe(命令行)并键入以下命令:

    net use X: \wsl$Ubuntuhomesimao
    

    X: 是将要创建的驱动器(您会在例如网络驱动器中看到它)我的电脑) 和 \wsl$Ubuntuhomesimao 是该驱动器根目录的 WSL 路径。 wsl$ 是告诉 Windows 连接到 WSL 的特殊主机名,Ubuntu 是 WSL 下的分发名称,最后 homesimao 是应该映射到 Ubuntu 分发中目录的路径。

    【讨论】:

      【解决方案2】:

      我面临同样的问题。您能否详细说明一下网络驱动器。

      当我使用 X 作为驱动器名称时,它给出

      发生系统错误 67。找不到网络名称。

      当我使用我的 Windows 驱动器 C 时,它给出了

      发生系统错误 85。本地设备名称已被使用。

      请帮我解决这个问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-09-14
        • 2016-01-25
        • 1970-01-01
        • 1970-01-01
        • 2023-03-31
        • 1970-01-01
        • 2012-01-25
        • 2016-07-30
        相关资源
        最近更新 更多