【问题标题】:Command in parcel.js --open 'google chrome' does not work on Windows, only works on MacOSparcel.js 中的命令 --open 'google chrome' 不适用于 Windows,仅适用于 MacOS
【发布时间】:2019-09-19 01:58:05
【问题描述】:

我使用 parcel.js 来设置我的项目。此命令 --open 'google chrome' 不适用于 Windows,仅适用于 MacOS。错误是:Windows 找不到“google”。请确保您输入的名称正确,然后重试。

【问题讨论】:

    标签: parceljs


    【解决方案1】:

    传递给--open [browser] 的浏览器值是平台相关的:

    • Windows:chrome
    • Linux:google-chrome
    • MacOS:google chrome

    包裹uses the opn package 以启动浏览器。来自opn documentation

    输入:string | string[]

    指定要打开target的应用程序,或应用程序的数组 和应用参数。

    应用名称取决于平台。不要将其硬编码为可重用 模块。例如,Chrome 在 macOS 上是 google chromegoogle-chrome 在 Linux 上,chrome 在 Windows 上。

    您也可以传入应用的完整路径。例如在 WSL 上,这可以 是/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe 用于 Chrome 的 Windows 安装。

    【讨论】:

      猜你喜欢
      • 2021-06-17
      • 1970-01-01
      • 1970-01-01
      • 2021-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-07
      相关资源
      最近更新 更多