You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows 10下使用Yarn发布至gh-pages失败求助

Fix ENOENT Path Error When Publishing to gh-pages via Yarn on Windows 10

I ran into a similar issue before on Windows—this error happens because Windows' command line (either Command Prompt or PowerShell) handles quotes and wildcard syntax differently than Unix-based shells. The single quotes around your --dist and --src arguments are being treated as part of the actual path, and the {} brace expansion isn't recognized, leading to that broken path '.' the system can't find.

Here are a couple of proven fixes:

1. Update the Script with Windows-Friendly Syntax

Modify your package.json script to use double quotes (escaped with \" since it's JSON) and replace the brace expansion with space-separated paths:

"scripts": {
  "gh-pages": "gh-pages --dist . --src \"index.html dist/** CNAME\""
}

This tells Windows to properly parse the paths without treating quotes as part of the file location, and gh-pages will correctly pick up the files you want to publish.

2. Simplify the Command (Optional)

If your goal is to publish exactly those three items from the root directory, you can even omit the --dist flag (gh-pages defaults to working with the current directory when using --src):

"scripts": {
  "gh-pages": "gh-pages --src \"index.html dist/** CNAME\""
}

Quick Checks to Rule Out Other Issues

  • Double-check that CNAME exists in your project root (note: gh-pages requires this filename to be uppercase, so make sure it's not cname).
  • Ensure there are no typos in the file/directory names you're targeting.

After updating the script, run yarn gh-pages again—it should work without the ENOENT error.

内容的提问来源于stack exchange,提问作者mahboub_mo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:16:25