SvelteKit deployment failing

Hi, i'm trying to deploy this app (https://github.com/Fabio53443/cogestione-mamiani) but i keep getting this error once the project is built.
15:48:33.763 Run npm run preview to preview your production build locally.
15:48:33.763
15:48:33.763 > Using @sveltejs/adapter-cloudflare
15:48:33.773 ✔ done
15:48:33.862 Finished
15:48:33.862 Found _worker.js in output directory. Uploading.
15:48:33.870 ⛅️ wrangler 3.92.0
15:48:33.870 -------------------
15:48:35.028 ▲ [WARNING] The package "node:events" wasn't found on the file system but is built into node.
15:48:35.029
15:48:35.029 Your Worker may throw errors at runtime unless you enable the "nodejs_compat" compatibility flag. Refer to https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details. Imported from:
15:48:35.029 - ../../node_modules/postgres/cf/polyfills.js
15:48:33.763 Run npm run preview to preview your production build locally.
15:48:33.763
15:48:33.763 > Using @sveltejs/adapter-cloudflare
15:48:33.773 ✔ done
15:48:33.862 Finished
15:48:33.862 Found _worker.js in output directory. Uploading.
15:48:33.870 ⛅️ wrangler 3.92.0
15:48:33.870 -------------------
15:48:35.028 ▲ [WARNING] The package "node:events" wasn't found on the file system but is built into node.
15:48:35.029
15:48:35.029 Your Worker may throw errors at runtime unless you enable the "nodejs_compat" compatibility flag. Refer to https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details. Imported from:
15:48:35.029 - ../../node_modules/postgres/cf/polyfills.js
and many more like that. how can i fix this? how can i add the node compat flag when i'm deploying from the webui? do i need to add the .toml to the git repo? thanks ☀️
GitHub
GitHub - Fabio53443/cogestione-mamiani: La piattaforma per la gesti...
La piattaforma per la gestione dei corsi della Cogestione al Mamiani - Fabio53443/cogestione-mamiani
2 Replies
Fabio53443
Fabio53443OP3mo ago
update: i've managed to add the nodejs_compat flag, but the deployment still fails! How can i fix this?
SheldonFromBBT
SheldonFromBBT3mo ago
Having the same issue! Even after adding the compatibility flag, it still fails In my case fs is also the module causing error, but even after prerendering the routes as instructed in docs, deployment still faild

Did you find this page helpful?