ok thanks, so are we able to use npm package in them ?
ok thanks, so are we able to use npm package in them ?
buffer)buffer then you might be able to use thatytdl-code to import from node:buffer instead and then use Workers NodeJS compat: https://developers.cloudflare.com/workers/runtime-apis/nodejs/node:buffer or finding an alternative package.node_compat = true to your wrangler.toml: https://developers.cloudflare.com/workers/wrangler/configuration/#node-compatibilitynode:buffer unfortunately.npx wrangler pages dev --compatibility-flags="nodejs_compat" -- npm run devnode_compat (the original one) works with Pages.node_compat vs nodejs_compat not the little js hehenpm install it and then search for buffer, fs, etc in node_modules but that might not catch everything.
node_compat vs nodejs_compatjust npm i -S and import, on Google we edit the package.json and it just work.
Your worker created multiple branches of a single stream (for instance, by calling response.clone() or request.clone()) but did not read the body of both branches. This is wasteful, as it forces the system to buffer the entire stream of data in memory, rather than streaming it through. This may cause your worker to be unexpectedly terminated for going over the memory limit. If you only meant to copy the request or response headers and metadata (e.g. in order to be able to modify them), use the appropriate constructors instead (for instance, new Response(response.body, response), new Request(request), etc).
wrangler pages dev public, but when deployed to CF its throwing 404.html


bufferbufferbufferytdl-codenode:buffernode:buffernode:buffernode_compat = truenpx wrangler pages dev --compatibility-flags="nodejs_compat" -- npm run devfs> Using @sveltejs/adapter-cloudflare
21:38:26.511 ✘ [ERROR] Could not resolve "crypto"
21:38:26.512
21:38:26.512 .svelte-kit/output/server/chunks/hooks.server.js:4:26:
21:38:26.513 4 │ import * as crypto$1 from "crypto";
21:38:26.513 ╵ ~~~~~~~~
21:38:26.513
21:38:26.513 The package "crypto" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.514
21:38:26.516 ✘ [ERROR] Could not resolve "node:buffer"
21:38:26.517
21:38:26.517 .svelte-kit/output/server/chunks/hooks.server.js:6:23:
21:38:26.517 6 │ import { Buffer } from "node:buffer";
21:38:26.517 ╵ ~~~~~~~~~~~~~
21:38:26.517
21:38:26.517 The package "node:buffer" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.517
...
21:38:26.532 error during build:
21:38:26.532 Error: Build failed with 4 errors:
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:4:26: ERROR: Could not resolve "crypto"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:6:23: ERROR: Could not resolve "node:buffer"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:7:26: ERROR: Could not resolve "node:crypto"
21:38:26.532 .svelte-kit/output/server/chunks/hooks.server.js:9:22: ERROR: Could not resolve "node:util"Your worker created multiple branches of a single stream (for instance, by calling or ) but did not read the body of both branches. This is wasteful, as it forces the system to buffer the entire stream of data in memory, rather than streaming it through. This may cause your worker to be unexpectedly terminated for going over the memory limit. If you only meant to copy the request or response headers and metadata (e.g. in order to be able to modify them), use the appropriate constructors instead (for instance, , , etc).
wrangler pages dev public