Skip to content

Cannot build on cloudflare #121

@Pasithea0

Description

@Pasithea0

I can't build on cloudflare pages. Using svelte adapter-auto it chooses cloudflare's adapter.
However, it does build with adapter-node but it just returns 404.
It works fine on vercel.

Here are the relevant logs:

Could not resolve "node:process"... Could not resolve "node:path"... Could not resolve "node:URL"... (Expand for log)
19:23:50.651 | > Using @sveltejs/adapter-auto
-- | --
19:23:50.935 | Installing @sveltejs/adapter-cloudflare...
19:23:51.514 | Progress: resolved 0, reused 1, downloaded 0, added 0
19:23:52.602 | Progress: resolved 325, reused 259, downloaded 6, added 0
19:23:52.605 | Packages: +6
19:23:52.609 | ++++++
19:23:52.754 | Progress: resolved 325, reused 260, downloaded 6, added 6, done
19:23:52.848 | .../[email protected]/node_modules/esbuild postinstall$ node install.js
19:23:52.949 | .../[email protected]/node_modules/esbuild postinstall: Done
19:23:53.251 |  
19:23:53.252 | devDependencies:
19:23:53.252 | + @sveltejs/adapter-cloudflare 3.0.2 (4.7.2 is available)
19:23:53.252 |  
19:23:53.254 | Done in 2.1s
19:23:53.340 | Successfully installed @sveltejs/adapter-cloudflare.
19:23:53.341 |  
19:23:53.341 | If you plan on staying on this deployment platform, consider replacing @sveltejs/adapter-auto with @sveltejs/adapter-cloudflare. This will give you faster and more robust installs, and more control over deployment configuration.
19:23:53.341 |  
19:23:54.019 | ✘ [ERROR] Could not resolve "node:process"
19:23:54.019 |  
19:23:54.019 | .svelte-kit/output/server/chunks/_page.js:2:20:
19:23:54.019 | 2 │ import minproc from "node:process";
19:23:54.019 | ╵                     ~~~~~~~~~~~~~~
19:23:54.019 |  
19:23:54.019 | The package "node:process" 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.
19:23:54.019 |  
19:23:54.020 | ✘ [ERROR] Could not resolve "node:path"
19:23:54.020 |  
19:23:54.020 | .svelte-kit/output/server/chunks/_page.js:3:20:
19:23:54.020 | 3 │ import minpath from "node:path";
19:23:54.020 | ╵                     ~~~~~~~~~~~
19:23:54.020 |  
19:23:54.020 | The package "node:path" 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.
19:23:54.020 |  
19:23:54.021 | ✘ [ERROR] Could not resolve "node:url"
19:23:54.021 |  
19:23:54.021 | .svelte-kit/output/server/chunks/_page.js:4:30:
19:23:54.021 | 4 │ import { fileURLToPath } from "node:url";
19:23:54.021 | ╵                               ~~~~~~~~~~
19:23:54.021 |  
19:23:54.021 | The package "node:url" 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.
19:23:54.021 |  
19:23:54.147 | error during build:
19:23:54.148 | Error: Build failed with 3 errors:
19:23:54.148 | .svelte-kit/output/server/chunks/_page.js:2:20: ERROR: Could not resolve "node:process"
19:23:54.149 | .svelte-kit/output/server/chunks/_page.js:3:20: ERROR: Could not resolve "node:path"
19:23:54.149 | .svelte-kit/output/server/chunks/_page.js:4:30: ERROR: Could not resolve "node:url"
19:23:54.149 | at failureErrorWithLog (/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1651:15)
19:23:54.149 | at /opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1059:25
19:23:54.150 | at /opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1004:52
19:23:54.150 | at buildResponseToResult (/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1057:7)
19:23:54.150 | at /opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1086:16
19:23:54.150 | at responseCallbacks.<computed> (/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:704:9)
19:23:54.150 | at handleIncomingPacket (/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:764:9)
19:23:54.150 | at Socket.readFromStdout (/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:680:7)
19:23:54.151 | at Socket.emit (node:events:514:28)
19:23:54.151 | at addChunk (node:internal/streams/readable:324:12)
19:23:54.219 | Failed: Error while executing user command. Exited with error code: 1
19:23:54.228 | Failed: build command exited with code: 1
19:23:55.291 | Failed: error occurred while running build command

These packages were not imported by me and it built fine after removing carta.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions