【问题标题】:npm cannot recognize dot slash notation in Windowsnpm 无法识别 Windows 中的点斜杠符号
【发布时间】:2022-02-21 23:39:48
【问题描述】:

我有以下几点:

"scripts": {
    "foo": "./node_modules/bar",
    }

npm run test 命令产生以下内容:

'.' is not recognized as an internal or external command, operable program or batch file.

【问题讨论】:

  • 目录分隔符在 Windows 上是 \ 而不是在 Linux/Mac 上的 /,因为它可以在有关 Naming Files, Paths, and Namespaces 的 Microsoft 文档中阅读。批处理文件npm.cmd 编码不够好,无法自动修复此类语法错误。

标签: testing npm cmd


【解决方案1】:

目录分隔符在 Windows 上是 \ 而不是 / 在 Linux/Mac 上,因为它可以在有关命名文件、路径和命名空间的 Microsoft 文档中阅读。批处理文件 npm.cmd 编码不够好,无法自动修复此类语法错误。

这是正确的,适用于 Git Bash

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-01
    • 2013-08-06
    • 2020-06-04
    • 2023-01-26
    • 1970-01-01
    • 1970-01-01
    • 2016-09-11
    • 1970-01-01
    相关资源
    最近更新 更多