Sveltekit App failing to deploy (Cannot find module '/app/build')

ciaranevansTRIAL

a year ago

Hey Folks,

I had a Sveltekit repository already (https://github.com/ciaranevans/archive28) and gave Railway a go, I had issues and decided to go back and use the Sveltekit template.

This worked so I then started to compare what was different. Mainly the differences were yarn being used and then the clincher, the adapter in the railway template was adapter-node

I've switched to adapter-node, added in start to my package.json so that it runs node build, but when my service for the linked repository builds, I get a successful build but the deployment fails:

node:internal/modules/cjs/loader:1080

throw err;

^

Error: Cannot find module '/app/build'

at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)

at Module._load (node:internal/modules/cjs/loader:922:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)

at node:internal/main/run_main_module:23:47 {

code: 'MODULE_NOT_FOUND',

requireStack: []

}

Node.js v18.18.2

Locally I'm running Node.js v21.5.0

When I run npm run build && npm run start, it works locally fine.

Solved

3 Replies


ciaranevansTRIAL

a year ago

Output of running locally:

$ npm run build && npm run start

> archive28-frontend@0.0.1 build
> vite build

vite v5.0.10 building SSR bundle for production...
 76 modules transformed.
Generated an empty chunk: "hooks.server".
Generated an empty chunk: "entries/pages/_layout.server.ts".
vite v5.0.10 building for production...
 63 modules transformed.
.svelte-kit/output/client/_app/version.json                              0.03 kB  gzip:  0.05 kB
.svelte-kit/output/client/.vite/manifest.json                            2.25 kB  gzip:  0.45 kB
.svelte-kit/output/client/_app/immutable/assets/0.tlJcQZV0.css           0.12 kB  gzip:  0.11 kB
.svelte-kit/output/client/_app/immutable/assets/2.5jZdPstR.css           0.25 kB  gzip:  0.18 kB
.svelte-kit/output/client/_app/immutable/nodes/0.gOGA9PP7.js             0.60 kB  gzip:  0.39 kB
.svelte-kit/output/client/_app/immutable/nodes/2.Mocq6Wfm.js             0.60 kB  gzip:  0.40 kB
.svelte-kit/output/client/_app/immutable/nodes/1.KZu_gyjt.js             0.97 kB  gzip:  0.57 kB
.svelte-kit/output/client/_app/immutable/chunks/scheduler.k-kUyWhY.js    2.16 kB  gzip:  1.02 kB
.svelte-kit/output/client/_app/immutable/chunks/singletons.DtCMluiM.js   2.92 kB  gzip:  1.49 kB
.svelte-kit/output/client/_app/immutable/chunks/index.5XCitCbI.js        5.24 kB  gzip:  2.20 kB
.svelte-kit/output/client/_app/immutable/entry/app._k0Mzemz.js           6.02 kB  gzip:  2.43 kB
.svelte-kit/output/client/_app/immutable/entry/start.4hp_nUgj.js        28.10 kB  gzip: 11.25 kB
 built in 659ms
.svelte-kit/output/server/.vite/manifest.json                          1.70 kB
.svelte-kit/output/server/_app/immutable/assets/_layout.Cc1NCg0p.css   0.12 kB
.svelte-kit/output/server/_app/immutable/assets/_page.5jZdPstR.css     0.25 kB
.svelte-kit/output/server/entries/pages/_layout.server.ts.js           0.00 kB
.svelte-kit/output/server/chunks/hooks.server.js                       0.00 kB
.svelte-kit/output/server/entries/pages/_layout.svelte.js              0.24 kB
.svelte-kit/output/server/internal.js                                  0.25 kB
.svelte-kit/output/server/entries/pages/_page.svelte.js                0.68 kB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js            0.89 kB
.svelte-kit/output/server/chunks/ssr.js                                3.35 kB
.svelte-kit/output/server/chunks/internal.js                           5.92 kB
.svelte-kit/output/server/index.js                                    93.93 kB

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-node
   done
 built in 2.65s

> archive28-frontend@0.0.1 start
> node build

Listening on 0.0.0.0:3000

ciaranevansTRIAL

a year ago

PEKCAK 😬 Just hadn't pushed the fixed commit 🤦

Apologies! It's late!


Status changed to Solved railway[bot] over 1 year ago