Cant build a page with Sveltekit?

Hello I've been working on my Sveltekit app locally for a few weeks and wanted to try it out on Cloudflare pages. But it fails to build. What's going on? ๐Ÿ˜ข
23:18:28.959 Success: Finished cloning repository files
23:18:29.893 Installing dependencies
23:18:29.902 Python version set to 2.7
23:18:32.643 v12.18.0 is already installed.
23:18:33.632 Now using node v12.18.0 (npm v6.14.4)
23:18:33.815 Started restoring cached build plugins
23:18:33.827 Finished restoring cached build plugins
23:18:34.216 Attempting ruby version 2.7.1, read from environment
23:18:37.114 Using ruby version 2.7.1
23:18:37.433 Using PHP version 5.6
23:18:37.564 5.2 is already installed.
23:18:37.586 Using Swift version 5.2
23:18:37.587 Started restoring cached node modules
23:18:37.599 Finished restoring cached node modules
23:18:37.805 Installing NPM modules using NPM version 6.14.4
23:18:39.661 npm WARN deprecated @types/[email protected]: This is a stub types definition for aws-sdk (https://github.com/aws/aws-sdk-js). aws-sdk provides its own type definitions, so you don't need @types/aws-sdk installed!
23:18:42.467 npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
23:18:45.349 npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
23:18:47.278 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @aws-sdk/credential-providers@^3.186.0 (node_modules/mongodb/node_modules/@aws-sdk/credential-providers):
23:18:47.279 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported engine for @aws-sdk/[email protected]: wanted: {"node":">=14.0.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
23:18:47.279 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Not compatible with your version of node/npm: @aws-sdk/[email protected]
23:18:28.959 Success: Finished cloning repository files
23:18:29.893 Installing dependencies
23:18:29.902 Python version set to 2.7
23:18:32.643 v12.18.0 is already installed.
23:18:33.632 Now using node v12.18.0 (npm v6.14.4)
23:18:33.815 Started restoring cached build plugins
23:18:33.827 Finished restoring cached build plugins
23:18:34.216 Attempting ruby version 2.7.1, read from environment
23:18:37.114 Using ruby version 2.7.1
23:18:37.433 Using PHP version 5.6
23:18:37.564 5.2 is already installed.
23:18:37.586 Using Swift version 5.2
23:18:37.587 Started restoring cached node modules
23:18:37.599 Finished restoring cached node modules
23:18:37.805 Installing NPM modules using NPM version 6.14.4
23:18:39.661 npm WARN deprecated @types/[email protected]: This is a stub types definition for aws-sdk (https://github.com/aws/aws-sdk-js). aws-sdk provides its own type definitions, so you don't need @types/aws-sdk installed!
23:18:42.467 npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
23:18:45.349 npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
23:18:47.278 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @aws-sdk/credential-providers@^3.186.0 (node_modules/mongodb/node_modules/@aws-sdk/credential-providers):
23:18:47.279 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported engine for @aws-sdk/[email protected]: wanted: {"node":">=14.0.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
23:18:47.279 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Not compatible with your version of node/npm: @aws-sdk/[email protected]
14 Replies
Whey
WheyOPโ€ข3y ago
23:18:47.279
23:18:47.287 npm ERR! code ENOTSUP
23:18:47.287 npm ERR! notsup Unsupported engine for @typescript-eslint/[email protected]: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
23:18:47.287 npm ERR! notsup Not compatible with your version of node/npm: @typescript-eslint/[email protected]
23:18:47.287 npm ERR! notsup Not compatible with your version of node/npm: @typescript-eslint/[email protected]
23:18:47.287 npm ERR! notsup Required: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"}
23:18:47.287 npm ERR! notsup Actual: {"npm":"6.14.4","node":"12.18.0"}
23:18:47.297
23:18:47.298 npm ERR! A complete log of this run can be found in:
23:18:47.298 npm ERR! /opt/buildhome/.npm/_logs/2023-01-14T22_18_47_292Z-debug.log
23:18:47.317 Error during NPM install
23:18:47.320 Failed: build command exited with code: 1
23:18:48.175 Failed: an internal error occurred
23:18:47.279
23:18:47.287 npm ERR! code ENOTSUP
23:18:47.287 npm ERR! notsup Unsupported engine for @typescript-eslint/[email protected]: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
23:18:47.287 npm ERR! notsup Not compatible with your version of node/npm: @typescript-eslint/[email protected]
23:18:47.287 npm ERR! notsup Not compatible with your version of node/npm: @typescript-eslint/[email protected]
23:18:47.287 npm ERR! notsup Required: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"}
23:18:47.287 npm ERR! notsup Actual: {"npm":"6.14.4","node":"12.18.0"}
23:18:47.297
23:18:47.298 npm ERR! A complete log of this run can be found in:
23:18:47.298 npm ERR! /opt/buildhome/.npm/_logs/2023-01-14T22_18_47_292Z-debug.log
23:18:47.317 Error during NPM install
23:18:47.320 Failed: build command exited with code: 1
23:18:48.175 Failed: an internal error occurred
Walshy
Walshyโ€ข3y ago
Looks like you're using node 12 but at least 16 is required
James
Jamesโ€ข3y ago
Try bumping your NODE_VERSION env var to 16
Walshy
Walshyโ€ข3y ago
Add the environment variable NODE_VERSION with the value 16
James
Jamesโ€ข3y ago
too slow
Walshy
Walshyโ€ข3y ago
Too old
Whey
WheyOPโ€ข3y ago
ooh thank you. Got a little bit further but a lot of new errors.
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongocr.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.923 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:5:21: ERROR: Could not resolve "http"
23:35:50.923 ...
23:35:50.923 at failureErrorWithLog (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1604:15)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1056:28
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1001:67
23:35:50.923 at buildResponseToResult (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1054:7)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1166:14
23:35:50.924 at responseCallbacks.<computed> (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:701:9)
23:35:50.924 at handleIncomingPacket (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:756:9)
23:35:50.924 at Socket.readFromStdout (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:677:7)
23:35:50.924 at Socket.emit (node:events:513:28)
23:35:50.924 at addChunk (node:internal/streams/readable:315:12)
23:35:50.943 Failed: build command exited with code: 1
23:35:52.167 Failed: an internal error occurred
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongocr.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.923 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:5:21: ERROR: Could not resolve "http"
23:35:50.923 ...
23:35:50.923 at failureErrorWithLog (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1604:15)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1056:28
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1001:67
23:35:50.923 at buildResponseToResult (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1054:7)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1166:14
23:35:50.924 at responseCallbacks.<computed> (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:701:9)
23:35:50.924 at handleIncomingPacket (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:756:9)
23:35:50.924 at Socket.readFromStdout (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:677:7)
23:35:50.924 at Socket.emit (node:events:513:28)
23:35:50.924 at addChunk (node:internal/streams/readable:315:12)
23:35:50.943 Failed: build command exited with code: 1
23:35:52.167 Failed: an internal error occurred
or its not possible to run with packages?
23:35:50.922 error during build:
23:35:50.922 Error: Build failed with 38 errors:
23:35:50.922 node_modules/ip/lib/ip.js:3:19: ERROR: Could not resolve "os"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/gssapi.js:4:20: ERROR: Could not resolve "dns"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongocr.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.923 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:5:21: ERROR: Could not resolve "http"
23:35:50.923 ...
23:35:50.923 at failureErrorWithLog (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1604:15)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1056:28
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1001:67
23:35:50.923 at buildResponseToResult (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1054:7)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1166:14
23:35:50.924 at responseCallbacks.<computed> (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:701:9)
23:35:50.924 at handleIncomingPacket (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:756:9)
23:35:50.924 at Socket.readFromStdout (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:677:7)
23:35:50.924 at Socket.emit (node:events:513:28)
23:35:50.924 at addChunk (node:internal/streams/readable:315:12)
23:35:50.943 Failed: build command exited with code: 1
23:35:52.167 Failed: an internal error occurred
23:35:50.922 error during build:
23:35:50.922 Error: Build failed with 38 errors:
23:35:50.922 node_modules/ip/lib/ip.js:3:19: ERROR: Could not resolve "os"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/gssapi.js:4:20: ERROR: Could not resolve "dns"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongocr.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.922 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:4:23: ERROR: Could not resolve "crypto"
23:35:50.923 node_modules/mongodb/lib/cmap/auth/mongodb_aws.js:5:21: ERROR: Could not resolve "http"
23:35:50.923 ...
23:35:50.923 at failureErrorWithLog (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1604:15)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1056:28
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1001:67
23:35:50.923 at buildResponseToResult (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1054:7)
23:35:50.923 at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1166:14
23:35:50.924 at responseCallbacks.<computed> (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:701:9)
23:35:50.924 at handleIncomingPacket (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:756:9)
23:35:50.924 at Socket.readFromStdout (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:677:7)
23:35:50.924 at Socket.emit (node:events:513:28)
23:35:50.924 at addChunk (node:internal/streams/readable:315:12)
23:35:50.943 Failed: build command exited with code: 1
23:35:52.167 Failed: an internal error occurred
James
Jamesโ€ข3y ago
You can run packages with Functions, but you won't be able to run Node.js packages, or things that rely on Node.js modules, probably like mongodb. Workers run JavaScript via V8, but not Node.js
Whey
WheyOPโ€ข3y ago
aha :/
James
Jamesโ€ข3y ago
If your site is static, you could use these things in your build script and then output HTML from it but you won't be able to hit something like Mongo with Functions today, at least not without some kind of HTTP transformer for the queries
Schmime
Schmimeโ€ข3y ago
Wait I thought with pages you could run node_compat mode? https://github.com/cloudflare/wrangler2/issues/1074
GitHub
Feature Request: Support --node-compat in wrangler pages build ยท Is...
What version of Wrangler are you using? 2.0.6 or beta What operating system are you using? Mac Describe the Bug App was rewrited from CRA to Remix and i&#39;ve moved all config from Remix Cloud...
Isaac McFadyen
Isaac McFadyenโ€ข3y ago
Functions doesn't support arbitrary TCP (only HTTP), so even if you could use node_compat MongoDB is still not usable unfortunately
Schmime
Schmimeโ€ข3y ago
@Isaac McFadyen | YYZ01 thank you for clarification friend ๐Ÿ™‚
Gagan Suie
Gagan Suieโ€ข2y ago
Howdy hoo. We actually explored this stack. (functions didn't work for us) our setup is as follows: frontend cloudflare pages backend cloudflare workers websockets (not socket.io) db mongodb atlas (using this forked adapter for mongo data API https://github.com/CodeCrowCorp/mongodb)

Did you find this page helpful?