Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during site building #9146

Closed
kg55kmr opened this issue Feb 21, 2023 · 1 comment · Fixed by #9349
Closed

Error during site building #9146

kg55kmr opened this issue Feb 21, 2023 · 1 comment · Fixed by #9349
Labels
bug Something isn't working

Comments

@kg55kmr
Copy link

kg55kmr commented Feb 21, 2023

Describe the bug

Sometimes when site is building it throws errors:

[15:11:38.730] Error: Not found: /_app/immutable/assets/14-1-f449e159.jpg
[15:11:38.731]     at resolve (file:///vercel/path0/.svelte-kit/output/server/index.js:2472:18)
[15:11:38.731]     at resolve (file:///vercel/path0/.svelte-kit/output/server/index.js:2339:34)
[15:11:38.731]     at #options.hooks.handle (file:///vercel/path0/.svelte-kit/output/server/index.js:2516:59)
[15:11:38.731]     at respond (file:///vercel/path0/.svelte-kit/output/server/index.js:2337:43)
[15:11:38.735] Error: Not found: /_app/immutable/assets/14-2-f608b219.jpg
[15:11:38.736]     at resolve (file:///vercel/path0/.svelte-kit/output/server/index.js:2472:18)
[15:11:38.736]     at resolve (file:///vercel/path0/.svelte-kit/output/server/index.js:2339:34)
[15:11:38.736]     at #options.hooks.handle (file:///vercel/path0/.svelte-kit/output/server/index.js:2516:59)
[15:11:38.736]     at respond (file:///vercel/path0/.svelte-kit/output/server/index.js:2337:43)
[15:11:38.740] file:///vercel/path0/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:53
[15:11:38.740] 					throw new Error(format(details));

Reproduction

I extracted part of site which I think is source of problem: https://github.com/kg55kmr/test
As I said errors not always throws, needs several running vite build.

Logs

> [email protected] build
> vite build


vite v4.1.3 building SSR bundle for production...
✓ 172 modules transformed.
10:08:19 [vite-plugin-svelte] ssr compile done.
package files    time     avg
site       71   0.67s   9.4ms

vite v4.1.3 building for production...
✓ 168 modules transformed.
10:08:29 [vite-plugin-svelte] dom compile done.
package files    time      avg
site       71   3.61s   50.9ms
.svelte-kit/output/client/_app/version.json                                                                                               0.03 kB
.svelte-kit/output/client/_app/immutable/assets/16-1-9c01ddb4.jpg                                                                         7.62 kB
.svelte-kit/output/client/_app/immutable/assets/20-1-b37b3e4b.jpg                                                                        13.86 kB
.svelte-kit/output/client/_app/immutable/assets/15-25a52cc8.jpg                                                                          17.11 kB
.svelte-kit/output/client/_app/immutable/assets/9-faeffa65.jpg                                                                           17.99 kB
.svelte-kit/output/client/_app/immutable/assets/5-dacfb584.jpg                                                                           18.45 kB
.svelte-kit/output/client/vite-manifest.json                                                                                             21.25 kB
.svelte-kit/output/client/_app/immutable/assets/14-a691a701.jpg                                                                          23.73 kB
.svelte-kit/output/client/_app/immutable/assets/13-cd312771.jpg                                                                          25.72 kB
.svelte-kit/output/client/_app/immutable/assets/22-b7b646b4.jpg                                                                          29.21 kB
.svelte-kit/output/client/_app/immutable/assets/8-3-ee726906.jpg                                                                         30.86 kB
.svelte-kit/output/client/_app/immutable/assets/21-6065adda.jpg                                                                          31.05 kB
.svelte-kit/output/client/_app/immutable/assets/4-3336b566.jpg                                                                           31.14 kB
.svelte-kit/output/client/_app/immutable/assets/19-fb927cf3.jpg                                                                          31.18 kB
.svelte-kit/output/client/_app/immutable/assets/11-53fcf3f5.jpg                                                                          31.88 kB
.svelte-kit/output/client/_app/immutable/assets/16-3-3b51dadb.jpg                                                                        32.67 kB
.svelte-kit/output/client/_app/immutable/assets/14-614f5eb8.jpg                                                                          32.98 kB
.svelte-kit/output/client/_app/immutable/assets/16-4-5abe6b59.jpg                                                                        33.71 kB
.svelte-kit/output/client/_app/immutable/assets/17-761a5ca9.jpg                                                                          39.18 kB
.svelte-kit/output/client/_app/immutable/assets/16-2-12688f21.jpg                                                                        40.20 kB
.svelte-kit/output/client/_app/immutable/assets/21-dc5e79d9.jpg                                                                          41.05 kB
.svelte-kit/output/client/_app/immutable/assets/19-8415bd96.jpg                                                                          42.08 kB
.svelte-kit/output/client/_app/immutable/assets/13-4d2fd709.jpg                                                                          42.60 kB
.svelte-kit/output/client/_app/immutable/assets/6-2fd44585.jpg                                                                           44.03 kB
.svelte-kit/output/client/_app/immutable/assets/15-3eb7fe3f.jpg                                                                          45.45 kB
.svelte-kit/output/client/_app/immutable/assets/18-d1e88905.jpg                                                                          45.96 kB
.svelte-kit/output/client/_app/immutable/assets/5-752cd3c6.jpg                                                                           46.77 kB
.svelte-kit/output/client/_app/immutable/assets/7-4493573a.jpg                                                                           52.68 kB
.svelte-kit/output/client/_app/immutable/assets/4-2-fe44a5d4.jpg                                                                         54.76 kB
.svelte-kit/output/client/_app/immutable/assets/9-c1fc4aa6.jpg                                                                           55.18 kB
.svelte-kit/output/client/_app/immutable/assets/18-2-19e5def5.jpg                                                                        55.41 kB
.svelte-kit/output/client/_app/immutable/assets/3-1-870f2930.jpg                                                                         56.51 kB
.svelte-kit/output/client/_app/immutable/assets/18-1-ec3a0210.jpg                                                                        58.74 kB
.svelte-kit/output/client/_app/immutable/assets/18-1-92439960.jpg                                                                        59.04 kB
.svelte-kit/output/client/_app/immutable/assets/2-1-4507756e.jpg                                                                         64.41 kB
.svelte-kit/output/client/_app/immutable/assets/3-2-3996a6d0.jpg                                                                         64.77 kB
.svelte-kit/output/client/_app/immutable/assets/7-698ef4e8.jpg                                                                           68.71 kB
.svelte-kit/output/client/_app/immutable/assets/12-681afb87.jpg                                                                          72.28 kB
.svelte-kit/output/client/_app/immutable/assets/18-2-c99cafa9.jpg                                                                        74.02 kB
.svelte-kit/output/client/_app/immutable/assets/20-2-44ef0c2a.jpg                                                                        76.02 kB
.svelte-kit/output/client/_app/immutable/assets/17-2845241f.jpg                                                                          78.46 kB
.svelte-kit/output/client/_app/immutable/assets/18-3-e5a5ee91.jpg                                                                        80.63 kB
.svelte-kit/output/client/_app/immutable/assets/8-d854a278.jpg                                                                           80.65 kB
.svelte-kit/output/client/_app/immutable/assets/2-2-e068a64c.jpg                                                                         82.52 kB
.svelte-kit/output/client/_app/immutable/assets/4-1-3e672ef4.jpg                                                                         86.24 kB
.svelte-kit/output/client/_app/immutable/assets/10-2-7e7cf53f.jpg                                                                        90.01 kB
.svelte-kit/output/client/_app/immutable/assets/18-4-4c9fd4ce.jpg                                                                        90.77 kB
.svelte-kit/output/client/_app/immutable/assets/1-6dc37d60.jpg                                                                          113.23 kB
.svelte-kit/output/client/_app/immutable/assets/20-e086af0d.jpg                                                                         122.85 kB
.svelte-kit/output/client/_app/immutable/assets/17-b367b5c8.jpg                                                                         128.08 kB
.svelte-kit/output/client/_app/immutable/assets/16-2-42608a25.jpg                                                                       131.55 kB
.svelte-kit/output/client/_app/immutable/assets/13-5f6c68e0.jpg                                                                         140.73 kB
.svelte-kit/output/client/_app/immutable/assets/11-02e9eec1.jpg                                                                         151.20 kB
.svelte-kit/output/client/_app/immutable/assets/8-1-f449e159.jpg                                                                        197.22 kB
.svelte-kit/output/client/_app/immutable/assets/8-2-f608b219.jpg                                                                        222.34 kB
.svelte-kit/output/client/_app/immutable/assets/10-1-d9d3b458.jpg                                                                       222.53 kB
.svelte-kit/output/client/_app/immutable/assets/16-5-603ecaa1.jpg                                                                       251.55 kB
.svelte-kit/output/client/_app/immutable/assets/_layout-c790a54c.css                                                                      5.33 kB │ gzip:  1.77 kB
.svelte-kit/output/client/_app/immutable/modules/pages/_layout.js-9cbb603b.js                                                             0.07 kB │ gzip:  0.09 kB
.svelte-kit/output/client/_app/immutable/chunks/1-ed86563e.js                                                                             0.09 kB │ gzip:  0.10 kB
.svelte-kit/output/client/_app/immutable/chunks/_layout-da46b06b.js                                                                       0.14 kB │ gzip:  0.14 kB
.svelte-kit/output/client/_app/immutable/chunks/3-4bfadb89.js                                                                             0.15 kB │ gzip:  0.13 kB
.svelte-kit/output/client/_app/immutable/chunks/2-210ced18.js                                                                             0.15 kB │ gzip:  0.13 kB
.svelte-kit/output/client/_app/immutable/chunks/4-0c9f88f0.js                                                                             0.15 kB │ gzip:  0.13 kB
.svelte-kit/output/client/_app/immutable/chunks/0-bb5cb93f.js                                                                             0.15 kB │ gzip:  0.14 kB
.svelte-kit/output/client/_app/immutable/components/pages/_layout.svelte-b99525b1.js                                                      0.55 kB │ gzip:  0.36 kB
.svelte-kit/output/client/_app/immutable/chunks/16-2-ef33d84d.js                                                                          0.63 kB │ gzip:  0.49 kB
.svelte-kit/output/client/_app/immutable/components/error.svelte-fd424b7f.js                                                              0.98 kB │ gzip:  0.57 kB
.svelte-kit/output/client/_app/immutable/chunks/singletons-6ca34d7b.js                                                                    2.56 kB │ gzip:  1.34 kB
.svelte-kit/output/client/_app/immutable/chunks/17-938f8c92.js                                                                            4.79 kB │ gzip:  2.00 kB
.svelte-kit/output/client/_app/immutable/chunks/index-0e553e1b.js                                                                         7.18 kB │ gzip:  2.92 kB
.svelte-kit/output/client/_app/immutable/chunks/advices-6cf804ce.js                                                                      18.76 kB │ gzip:  7.00 kB
.svelte-kit/output/client/_app/immutable/start-ca07c8e0.js                                                                               29.21 kB │ gzip: 11.18 kB
.svelte-kit/output/client/_app/immutable/components/pages/psychological-service/psychologist/advices-pupils/_page.svelte-8562f3df.js    176.24 kB │ gzip: 55.25 kB
.svelte-kit/output/client/_app/immutable/components/pages/psychological-service/psychologist/advices-teachers/_page.svelte-6ea10387.js  188.67 kB │ gzip: 56.29 kB
.svelte-kit/output/client/_app/immutable/components/pages/psychological-service/psychologist/advices-parents/_page.svelte-a0580b86.js   231.38 kB │ gzip: 70.63 kB
Error: Not found: /_app/immutable/assets/14-1-f449e159.jpg
    at resolve (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2519:18)
    at resolve (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2386:34)
    at #options.hooks.handle (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2563:59)
    at respond (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2384:43)
Error: Not found: /_app/immutable/assets/14-2-f608b219.jpg
    at resolve (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2519:18)
    at resolve (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2386:34)
    at #options.hooks.handle (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2563:59)
    at respond (file:///D:/Temp/test/.svelte-kit/output/server/index.js:2384:43)
file:///D:/Temp/test/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:53
                                        throw new Error(format(details));
                                              ^

Error: 404 /_app/immutable/assets/14-1-f449e159.jpg (linked from /psychological-service/psychologist/advices-pupils)
    at file:///D:/Temp/test/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:53:12
    at save (file:///D:/Temp/test/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:355:4)
    at visit (file:///D:/Temp/test/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:204:3)

Node.js v18.14.1
[vite-plugin-sveltekit-compile] Failed with code 1
error during build:
Error: Failed with code 1
    at ChildProcess.<anonymous> (file:///D:/Temp/test/node_modules/@sveltejs/kit/src/utils/fork.js:68:13)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (2) x64 AMD Athlon(tm) II X2 240 Processor
    Memory: 1.03 GB / 3.87 GB
  Binaries:
    Node: 18.14.1 - C:\Program Files\nodejs\node.EXE
    npm: 9.3.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (109.0.1518.78)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @sveltejs/adapter-static: ^2.0.1 => 2.0.1
    @sveltejs/kit: ^1 => 1.7.2
    svelte: ^3.46.3 => 3.55.1
    vite: ^4.0.2 => 4.1.3

Severity

annoyance

Additional Information

I am not sure if it sveltekit or vite bug.

@eltigerchino eltigerchino added the bug Something isn't working label Feb 21, 2023
@eltigerchino
Copy link
Member

eltigerchino commented Feb 21, 2023

As a temporary workaround, you can add export const ssr = false to your root +layout.js file.
https://kit.svelte.dev/docs/adapter-static#spa-mode-turn-off-ssr
I was able to consistently build several times without any errors, although I'm not 100% sure why that fixes it (I just followed a hunch the issue was caused by SSR).

The main issue is that the image files (assets) are not being output as a client asset /.svelte-kit/output/client/_app/immutable/. So, while prerendering, the process errors when it can't find the asset at that path. However, they're available in the server assets /output/server/_app/immutable/.

This is related to Vite 4.1 vitejs/vite#11429 and SvelteKit #9073 separately outputting server assets and client assets:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants