Kite
Kite
Explore posts from servers
CDCloudflare Developers
Created by Kite on 4/1/2024 in #pages-help
How to resolve `node:crypto` error during Sveltekit deploy
Run npm run preview to preview your production build locally.
12:28:16.327
12:28:16.327 > Using @sveltejs/adapter-cloudflare
12:28:16.697 ✔ done
12:28:16.914 Finished
12:28:16.914 Found _worker.js in output directory. Uploading.
12:28:18.231 ✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.
12:28:18.232
12:28:18.232
12:28:18.235
12:28:18.236 ✘ [ERROR] Could not resolve "node:crypto"
12:28:18.236
12:28:18.236 _worker.js:64950:26:
12:28:18.236 64950 │ import { webcrypto } from "node:crypto";
12:28:18.236~~~~~~~~~~~~~
12:28:18.237
12:28:18.237 The package "node:crypto" wasn't found on the file system but is built into node.
12:28:18.237 Add the "nodejs_compat" compatibility flag to your Pages project to enable Node.js compatibility.
12:28:18.237
12:28:18.237
12:28:18.238 ✘ [ERROR] Build failed with 1 error:
12:28:18.238
12:28:18.239 _worker.js:64950:26: ERROR: Could not resolve "node:crypto"
12:28:18.239
12:28:18.239
12:28:18.251 Failed building Pages Functions.
12:28:19.652 Failed: generating Pages Functions failed. Check the logs above for more information. If this continues for an unknown reason, contact support: https://cfl.re/3WgEyrH
Run npm run preview to preview your production build locally.
12:28:16.327
12:28:16.327 > Using @sveltejs/adapter-cloudflare
12:28:16.697 ✔ done
12:28:16.914 Finished
12:28:16.914 Found _worker.js in output directory. Uploading.
12:28:18.231 ✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.
12:28:18.232
12:28:18.232
12:28:18.235
12:28:18.236 ✘ [ERROR] Could not resolve "node:crypto"
12:28:18.236
12:28:18.236 _worker.js:64950:26:
12:28:18.236 64950 │ import { webcrypto } from "node:crypto";
12:28:18.236~~~~~~~~~~~~~
12:28:18.237
12:28:18.237 The package "node:crypto" wasn't found on the file system but is built into node.
12:28:18.237 Add the "nodejs_compat" compatibility flag to your Pages project to enable Node.js compatibility.
12:28:18.237
12:28:18.237
12:28:18.238 ✘ [ERROR] Build failed with 1 error:
12:28:18.238
12:28:18.239 _worker.js:64950:26: ERROR: Could not resolve "node:crypto"
12:28:18.239
12:28:18.239
12:28:18.251 Failed building Pages Functions.
12:28:19.652 Failed: generating Pages Functions failed. Check the logs above for more information. If this continues for an unknown reason, contact support: https://cfl.re/3WgEyrH
name = "--project_name"
account_id = "--my_id"

compatibility_flags = [ "nodejs_compat" ]
name = "--project_name"
account_id = "--my_id"

compatibility_flags = [ "nodejs_compat" ]
I've tried creating a wrangler.toml file with the node compat config but it doesn't change the outcome.
4 replies
CDCloudflare Developers
Created by Kite on 5/22/2023 in #pages-help
How do I rebuild my static website?
Hello. I cant find the option to rebuild site anywhere
8 replies