DEV Community

Discussion on: Deploy SvelteKit with SSR on Coolify (Hetzner VPS)

Collapse
 
digitaldrreamer profile image
Wale Bashir

Hey @mandrasch
Thanks for posting this. I tried deploying my sveltekit app on my new coolify instance, but I keep getting these error. It's been a tiring day so far. I'd appreciate any help I could get:
Error: UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)

Error 1

Error 2

Log:

#13 4.916 npm notice
2025-Jan-13 11:26:59.713323
#13 ERROR: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1
2025-Jan-13 11:26:59.713323
------
2025-Jan-13 11:26:59.713323
 > [stage-0  9/11] RUN --mount=type=cache,id=wwwkcck0g84gg0cwosk4gc80-node_modules/cache,target=/app/node_modules/.cache npm run build:
2025-Jan-13 11:26:59.713323
4.895     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
2025-Jan-13 11:26:59.713323
4.895     at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
2025-Jan-13 11:26:59.713323
4.895     at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
2025-Jan-13 11:26:59.713323
4.895     at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
2025-Jan-13 11:26:59.713323
4.895     at link (node:internal/modules/esm/module_job:75:36)
2025-Jan-13 11:26:59.713323
4.916 npm notice
2025-Jan-13 11:26:59.713323
4.916 npm notice New major version of npm available! 10.9.2 -> 11.0.0
2025-Jan-13 11:26:59.713323
4.916 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
2025-Jan-13 11:26:59.713323
4.916 npm notice To update run: npm install -g npm@11.0.0
2025-Jan-13 11:26:59.713323
4.916 npm notice
2025-Jan-13 11:26:59.713323
------
2025-Jan-13 11:26:59.713323
2025-Jan-13 11:26:59.713323
 1 warning found (use docker --debug to expand):
2025-Jan-13 11:26:59.713323
 - UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)
2025-Jan-13 11:26:59.713323
Dockerfile:24
2025-Jan-13 11:26:59.713323
--------------------
2025-Jan-13 11:26:59.713323
  22 |     # build phase
2025-Jan-13 11:26:59.713323
  23 |     COPY . /app/.
2025-Jan-13 11:26:59.713323
  24 | >>> RUN --mount=type=cache,id=wwwkcck0g84gg0cwosk4gc80-node_modules/cache,target=/app/node_modules/.cache npm run build
2025-Jan-13 11:26:59.713323
  25 |     
2025-Jan-13 11:26:59.713323
  26 |     
2025-Jan-13 11:26:59.713323
--------------------
2025-Jan-13 11:26:59.713323
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1
2025-Jan-13 11:26:59.721221
Deployment failed. Removing the new version of your application.
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mandrasch profile image
Matthias Andrasch • Edited

Hi,

I found this issue (github.com/coollabsio/coolify/issu...) which seems to be related to fresh coolify servers.

My approach would be to try it with the official SvelteKit demo (with adapter-node) first before using your own project to make sure there is not something in your project causing this:

github.com/mandrasch/sveltekit-dem...

If that does not work either, I would try Coolify Discord ... and just saw you posted there already 👍 Good luck, hope you figure it out soon!

Collapse
 
digitaldrreamer profile image
Wale Bashir

Thanks @mandrasch
I was eventually able to get it to work. Seems like I installed some dependencies needed during runtime as devDependencies🥲

Thread Thread
 
mandrasch profile image
Matthias Andrasch

Thanks for feedback! I change my guide to just use npm ci, because other devs (including myself) ran into this problem as well for certain projects. Have fun with SvelteKit!