kit: Can't SvelteKit app on Vercel

Describe the bug

Tried deploying on Vercel but the build part is failing because of output directory. Vercel is expecting public to be the output directory.

Reproduction

Unfortunately I can’t provide a link to the repo since it is a private project

Logs

[02:37:12.273] Cloning github.com/Freelance-Gigs/college-finder-app (Branch: develop, Commit: c903ffe)
[02:37:12.865] Cloning completed: 591.79ms
[02:37:12.964] Installing build runtime...
[02:37:14.798] Build runtime installed: 1.834s
[02:37:15.941] No Build Cache available
[02:37:16.086] Detected package.json
[02:37:16.086] Installing dependencies...
[02:37:16.088] Detected `package-lock.json` generated by npm 7...
[02:37:22.433] 
[02:37:22.433] > college-finder-app@1.0.0 prepare
[02:37:22.433] > svelte-kit sync
[02:37:22.433] 
[02:37:22.577] 
[02:37:22.578] added 237 packages in 6s
[02:37:22.578] 
[02:37:22.578] 39 packages are looking for funding
[02:37:22.578]   run `npm fund` for details
[02:37:22.785] Detected `package-lock.json` generated by npm 7...
[02:37:22.785] Running "npm run build"
[02:37:23.065] 
[02:37:23.065] > college-finder-app@1.0.0 build
[02:37:23.065] > svelte-kit build
[02:37:23.065] 
[02:37:23.384] vite v2.9.6 building for production...
[02:37:23.486] transforming...
[02:37:29.268] ✓ 208 modules transformed.
[02:37:29.445] rendering chunks...
[02:37:29.590] .svelte-kit/output/client/_app/manifest.json                                        2.11 KiB
[02:37:29.591] .svelte-kit/output/client/_app/pages/__layout.svelte-4032d3ea.js                    2.39 KiB / gzip: 1.16 KiB
[02:37:29.594] .svelte-kit/output/client/_app/error.svelte-efb7648d.js                             1.56 KiB / gzip: 0.75 KiB
[02:37:29.595] .svelte-kit/output/client/_app/pages/index.svelte-afc64a48.js                       9.18 KiB / gzip: 3.37 KiB
[02:37:29.595] .svelte-kit/output/client/_app/chunks/index-e09e217c.js                             0.80 KiB / gzip: 0.49 KiB
[02:37:29.595] .svelte-kit/output/client/_app/chunks/singletons-d1fb5791.js                        0.05 KiB / gzip: 0.07 KiB
[02:37:29.595] .svelte-kit/output/client/_app/start-54dcabb1.js                                    23.25 KiB / gzip: 8.65 KiB
[02:37:29.595] .svelte-kit/output/client/_app/chunks/navigation-73ae68f0.js                        1.06 KiB / gzip: 0.69 KiB
[02:37:29.595] .svelte-kit/output/client/_app/chunks/index-087532fe.js                             12.40 KiB / gzip: 5.06 KiB
[02:37:29.596] .svelte-kit/output/client/_app/assets/pages/find-college/_id_.svelte-f29ff347.css   45.33 KiB / gzip: 6.79 KiB
[02:37:29.596] .svelte-kit/output/client/_app/assets/pages/__layout.svelte-251776ad.css            12.23 KiB / gzip: 3.35 KiB
[02:37:29.601] .svelte-kit/output/client/_app/pages/find-college/_id_.svelte-15bce451.js           252.70 KiB / gzip: 83.33 KiB
[02:37:29.612] vite v2.9.6 building SSR bundle for production...
[02:37:29.745] transforming...
[02:37:30.017] ✓ 14 modules transformed.
[02:37:30.018] [rollup-plugin-dynamic-import-variables] Argument name clash (79:132)
[02:37:30.018] file: /vercel/path0/src/components/ProfileInformation.svelte:79:132
[02:37:30.020] (node:442) UnhandledPromiseRejectionWarning: SyntaxError: Argument name clash (79:132)
[02:37:30.021]     at Parser.pp$4.raise (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:19680:13)
[02:37:30.021]     at Parser.pp$7.checkLValSimple (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:18353:18)
[02:37:30.021]     at Parser.pp$7.checkLValPattern (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:18398:10)
[02:37:30.021]     at Parser.pp$7.checkLValInnerPattern (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:18420:10)
[02:37:30.021]     at Parser.pp$5.checkParams (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:19533:10)
[02:37:30.021]     at Parser.pp$5.parseFunctionBody (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:19503:10)
[02:37:30.021]     at Parser.pp$5.parseArrowExpression (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:19467:8)
[02:37:30.021]     at Parser.pp$5.parseParenArrowList (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:19196:15)
[02:37:30.021]     at Parser.pp$5.parseParenAndDistinguishExpression (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:19162:19)
[02:37:30.021]     at Parser.pp$5.parseExprAtom (/vercel/path0/node_modules/rollup/dist/shared/rollup.js:19014:41)
[02:37:30.021] (Use `node --trace-warnings ...` to show where the warning was created)
[02:37:30.022] (node:442) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[02:37:30.022] (node:442) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[02:37:30.695] Error: No Output Directory named "public" found after the Build completed. You can configure the Output Directory in your Project Settings. Learn More: https://vercel.link/missing-public-directory

System Info

System:
    OS: macOS 12.3
    CPU: (8) x64 Apple M1
    Memory: 38.69 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.3 - /usr/local/bin/node
    Yarn: 1.22.15 - /usr/local/bin/yarn
    npm: 8.5.5 - /usr/local/bin/npm
  Browsers:
    Chrome: 100.0.4896.127
    Safari: 15.4
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.39 
    @sveltejs/kit: next => 1.0.0-next.322 
    svelte: ^3.47.0 => 3.47.0

Severity

blocking all usage of SvelteKit

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Could you have a “working with monorepos” section in the general docs under advanced? It’d be a small section but probably worthwhile

Could also flag the gotcha that it’s currently not possible to extend sveltekit tsconfig if you have a shared tsconfig for the monorepo

I started a brand new SvelteKit project and attempted to deploy it to Vercel, and I got the error that the OP describes about a missing public directory.

It turns out that the problem was because I had configured it to use the Node.js adapter, as specified in the SvelteKit docs. (I had done this so that I could test out a deployment on my local computer.)

So, if this is happening to you, the solution is to convert your project back to the adapter-auto and remove the out field from the adapter argument.

Copying from https://github.com/oneezy/monorepo/issues/1#issuecomment-1441117634 in case anyone else is using Turbo + Vercel + Sveltekit.

----->%-------

thought i’d just leave this here since i was having the same issue and this was the first result: if you’re using turborepo, don’t forget the .vercel/ directory in the build output!

"pipeline": {
  "build": {
    "dependsOn": [...]
-   "outputs": [..., ".svelte-kit/**"],
+   "outputs": [..., ".svelte-kit/**", ".vercel/**"],
    ...
  },
}

what do you mean when you say “remove the out field from the adapter argument”?

Read Svelte docs and look what they say:

image

For node.js, they recommend making these two changes, which includes adding an “out” field. So, if you want to deploy to Vercel, you have to remember to revert these changes back to the hello-world default.

@frontycore similar case on this end. I had this working fine at one point and something changed. Did you ever find a solution?

I created an issue on my repo i’ll link here as well: https://github.com/oneezy/monorepo/issues/1

@Conduitry can we reopen this? seems to be affecting a few people