Sveltekit adapter-node : Fail to run preview (missing client directory)

34 Views Asked by At

I added a +server.js page for an API route. The npm run build works but when I try to npm run preview I get this error :

error when starting preview server:
Error: ENOENT: no such file or directory, scandir '/Users/.../myapp/.svelte-kit/output/client'
...Other errors...

There is indeed only a server folder in the .sveltekit output folder but I thought preview was reading the build folder (in which there is both client and server folders).

Any hint on what to look for ? I can't find any clue online...

UPDATE : I restarted the computer (well who knows...) and now the error is slightly different...

error when starting preview server:
Error: Server files not found at /Users/.../myapp/.svelte-kit/output/server, did you run `build` first?

Hope this helps...

1

There are 1 best solutions below

0
On

Not sure why, but I deleted the files in the "build" and ".sveltekit" folder and now it works... I hope this will help other ones.