"yarn build" fails to build in Windows 10
未關閉
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 11.8k
- 分支
- 7.9k
- 平均合併
- 1 天 11 小時
- 30 天內合併 PR
- 11
描述
What?
yarn build on Windows 10 fails to build (while yarn dev runs smoothly).
How to reproduce the error
Run the following command
yarn build
Detailed Error Message
PS C:\misc\sources\Github\pr\reactjs.org> yarn build
yarn run v1.12.1
$ gatsby build
success open and validate gatsby-config — 0.005 s
success load plugins — 0.223 s
success onPreInit — 0.931 s
success delete html and css files from previous builds — 0.183 s
success initialize cache — 0.009 s
success copy gatsby files — 0.333 s
success onPreBootstrap — 0.021 s
success source and transform nodes — 0.663 s
success building schema — 0.384 s
success createPages — 0.347 s
success createPagesStatefully — 0.041 s
success onPreExtractQueries — 0.015 s
success update schema — 0.171 s
success extract queries from components — 0.144 s
success run graphql queries — 0.197 s — 69/69 353.97 queries/second
success write out page data — 0.031 s
success write out redirect data — 0.012 s
success onPostBootstrap — 0.001 s
info bootstrap finished - 5.941 s
success Building production JavaScript and CSS bundles — 5.190 s
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
5 | function __webpack_require__(moduleId) {
6 |
> 7 | // Check if module is in cache
| ^
8 | if(installedModules[moduleId]) {
9 | return installedModules[moduleId].exports;
10 | }
WebpackError: C:\misc\sources\Github\pr\reactjs.org\public\C:\misc\sources\Github\pr\reactjs.org\examples\16-3-release-blog-post\context-example contains invalid WIN32 path characters.
- bootstrap:7 Object.mkdirs
lib/webpack/bootstrap:7:1
- universalModuleDefinition:5 Object.mkdirs
lib/webpack/universalModuleDefinition:5:1
- bootstrap:9 pathExists
lib/webpack/bootstrap:9:1
- bootstrap:12 fn.apply.then.r
lib/webpack/bootstrap:12:1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error Demo
Following image shows that yarn dev runs without an issue while yarn build fails.

Environment
- Fork: https://github.com/dance2die/reactjs.org
- Yarn version: 1.12.1
- Node version: 10.1.0
- Git version: 2.17.1.windows.2
- OS

貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 yarn build 入口開始,在 Windows 10 上重現 Gatsby 靜態 HTML 建置期間的失敗。透過 Webpack 建置輸出和路徑處理流程,追蹤回報的無效 WIN32 路徑;當生產環境建置在 Windows 上成功完成且 yarn dev 繼續正常運作時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, node.js
- 領域
- build-system
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100