sveltejs / kit

web development, streamlined
https://kit.svelte.dev
MIT License
18.57k stars 1.91k forks source link

Identical Code Builds on Linux and Fails on Windows #12632

Open Guandor opened 1 month ago

Guandor commented 1 month ago

Describe the bug

Hi,

Apologies if this is actually a Vite bug, but I've been trying to solve this and I still don't have the slightest clue what causes it.

Basically, I'm trying to run a static blog starter template that's made with Sveltekit, and while it builds successfully on Linux, it does not build on Windows. There are no issues in the development server.

There are also others experiencing the same issue here.

Reproduction

https://github.com/josh-collinsworth/sveltekit-blog-starter Just clone, install, and run "npm run build" on a Windows machine.

Logs

D:\>git clone https://github.com/josh-collinsworth/sveltekit-blog-starter.git
Cloning into 'sveltekit-blog-starter'...
remote: Enumerating objects: 1316, done.
remote: Counting objects: 100% (438/438), done.
remote: Compressing objects: 100% (158/158), done.
remote: Total 1316 (delta 328), reused 289 (delta 279), pack-reused 878 (from 1)Receiving objects:  95% (1251/1316)
Receiving objects: 100% (1316/1316), 890.26 KiB | 5.63 MiB/s, done.
Resolving deltas: 100% (676/676), done.

D:\>cd sveltekit-blog-starter

D:\sveltekit-blog-starter>npm install

added 206 packages, and audited 207 packages in 3s

52 packages are looking for funding
  run `npm fund` for details

3 vulnerabilities (2 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

D:\sveltekit-blog-starter>npm run build

> sveltekit-blog-starter@2.0.2 build
> vite build

vite v5.0.12 building SSR bundle for production...
✓ 120 modules transformed.
vite v5.0.12 building for production...
✓ 109 modules transformed.
.svelte-kit/output/client/_app/version.json                                               0.03 kB │ gzip:  0.05 kB
.svelte-kit/output/client/.vite/manifest.json                                             9.13 kB │ gzip:  1.02 kB
.svelte-kit/output/client/_app/immutable/chunks/each.-oqiv04n.js                          0.07 kB │ gzip:  0.09 kB
.svelte-kit/output/client/_app/immutable/chunks/index.oiCz_B55.js                         0.11 kB │ gzip:  0.12 kB
.svelte-kit/output/client/_app/immutable/nodes/10.-Jkt8VXt.js                             0.19 kB │ gzip:  0.17 kB
.svelte-kit/output/client/_app/immutable/nodes/8.-Jkt8VXt.js                              0.19 kB │ gzip:  0.17 kB
.svelte-kit/output/client/_app/immutable/chunks/config.9TwfRihT.js                        0.30 kB │ gzip:  0.22 kB
.svelte-kit/output/client/_app/immutable/chunks/control.pJ1mnnAb.js                       0.34 kB │ gzip:  0.21 kB
.svelte-kit/output/client/_app/immutable/chunks/Callout.nURPR5V5.js                       0.74 kB │ gzip:  0.48 kB
.svelte-kit/output/client/_app/immutable/chunks/preload-helper.0HuHagjb.js                0.91 kB │ gzip:  0.56 kB
.svelte-kit/output/client/_app/immutable/nodes/1.VNuMEGxU.js                              1.42 kB │ gzip:  0.81 kB
.svelte-kit/output/client/_app/immutable/nodes/4.nm-9FCdO.js                              1.44 kB │ gzip:  0.77 kB
.svelte-kit/output/client/_app/immutable/nodes/2.6w0XOXG4.js                              1.64 kB │ gzip:  0.87 kB
.svelte-kit/output/client/_app/immutable/nodes/5.pmzCVTh9.js                              1.84 kB │ gzip:  0.97 kB
.svelte-kit/output/client/_app/immutable/nodes/3.D12ZgMzU.js                              1.99 kB │ gzip:  1.04 kB
.svelte-kit/output/client/_app/immutable/nodes/7.I6YjyeOj.js                              2.19 kB │ gzip:  1.14 kB
.svelte-kit/output/client/_app/immutable/chunks/mdsvex-component-example.LqmTZtTL.js      2.34 kB │ gzip:  1.20 kB
.svelte-kit/output/client/_app/immutable/chunks/scheduler.w-57vXuY.js                     2.37 kB │ gzip:  1.12 kB
.svelte-kit/output/client/_app/immutable/nodes/11.PH-szZgl.js                             2.77 kB │ gzip:  1.34 kB
.svelte-kit/output/client/_app/immutable/nodes/6.I-h6iyeN.js                              2.77 kB │ gzip:  1.34 kB
.svelte-kit/output/client/_app/immutable/chunks/singletons.NE0IJQOC.js                    2.98 kB │ gzip:  1.52 kB
.svelte-kit/output/client/_app/immutable/nodes/9.oeFbPLpq.js                              3.08 kB │ gzip:  1.47 kB
.svelte-kit/output/client/_app/immutable/nodes/13.ZBZzIstQ.js                             3.13 kB │ gzip:  1.41 kB
.svelte-kit/output/client/_app/immutable/chunks/heading-links-example.JbgAm10F.js         3.27 kB │ gzip:  1.28 kB
.svelte-kit/output/client/_app/immutable/chunks/Pagination.EipgH4MA.js                    4.82 kB │ gzip:  2.06 kB
.svelte-kit/output/client/_app/immutable/chunks/syntax-highlighting-example.2PzTuTUl.js   6.00 kB │ gzip:  1.93 kB
.svelte-kit/output/client/_app/immutable/nodes/12.zf5sKF_w.js                             6.15 kB │ gzip:  2.59 kB
.svelte-kit/output/client/_app/immutable/entry/app.BWLVTiTh.js                            6.93 kB │ gzip:  2.37 kB
.svelte-kit/output/client/_app/immutable/chunks/index.hMcl6jSy.js                         9.97 kB │ gzip:  4.21 kB
.svelte-kit/output/client/_app/immutable/nodes/0.LduFDfUP.js                             12.19 kB │ gzip:  4.40 kB
.svelte-kit/output/client/_app/immutable/chunks/README.18CQG2E9.js                       22.82 kB │ gzip:  8.07 kB
.svelte-kit/output/client/_app/immutable/entry/start.8Heh7p80.js                         27.86 kB │ gzip: 11.20 kB
✓ built in 860ms
  301 /blog/page -> /blog

node:internal/event_target:1096
  process.nextTick(() => { throw err; });
                           ^
Error: ENOENT: no such file or directory, open 'D:\sveltekit-blog-starter\.svelte-kit\output\prerendered\pages\api\posts\page\*'
    at Object.openSync (node:fs:573:18)
    at writeFileSync (node:fs:2357:35)
    at save (file:///D:/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:384:4)
    at visit (file:///D:/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:232:3) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'D:\\sveltekit-blog-starter\\.svelte-kit\\output\\prerendered\\pages\\api\\posts\\page\\*'
}

Node.js v22.0.0

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 7.79 GB / 15.95 GB
  Binaries:
    Node: 22.0.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.1 - C:\Program Files\nodejs\npm.CMD
    bun: 1.1.26 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @sveltejs/adapter-static: ^3.0.0 => 3.0.1
    @sveltejs/kit: ^2.0.0 => 2.0.6
    @sveltejs/vite-plugin-svelte: ^3.0.0 => 3.0.1
    svelte: ^4.2.7 => 4.2.8
    vite: ^5.0.12 => 5.0.12

Severity

blocking all usage of SvelteKit

Additional Information

No response

Guandor commented 1 week ago

Vite people confirmed that this must be an issue on SvelteKit side.