Open fmaclen opened 1 month ago
You’ll have to change the build node version to 18.8 or higher since cloudflare’s default is lower. You can read how in the link below https://developers.cloudflare.com/pages/configuration/language-support-and-tools/#supported-languages-and-tools
@eltigerchino ah, thanks for the clarification!
I ended up creating a .node-version
file with: 18.18.0
and that fixed the deployment issue.
I'm wondering if we should specify the node version for builds in .npmrc or the engines field in package.json (which doesn't work for cloudflare pages). This could become an issue with other platforms too.
I was going to file another issue but I'm running into a similar situation with @sveltejs/enhanced-img
(0.3.0
) where I need to manually set these optional dependencies for the Cloudflare build to suceed:
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.0.0",
"@cloudflare/workerd-linux-64": "1.20240701.0"
},
I'm guessing this is because the package-lock.json
was generated on an arm-based system and Cloudflare runs on x68.
I'm wondering if we should specify the node version for builds in .npmrc or the engines field in package.json (which doesn't work for cloudflare pages). This could become an issue with other platforms too.
Our engines field requires 18.13: https://github.com/sveltejs/kit/blob/144fb75c8280695d8aeb3228904bebb262e171a7/packages/kit/package.json#L105
It seems the issue is that the project is using eslint, which requires a higher version. I'm not sure there's anything we can or should do about this on our side. Maybe we could have the wizard also ask you to setup an adapter and if you choose both cloudflare and eslint then we can create an .npmrc
for you
The best thing might be for Cloudflare to start using a newer version of Node by default. I imagine this will be hitting lots of users whether or not they're using SvelteKit since eslint is so popular. FYI @dario-piotrowicz
Maybe we could have the wizard also ask you to setup an adapter and if you choose both cloudflare and eslint then we can create an .npmrc for you
@benmccann could you add an .npmrc
to always just use a higher node version when the cloudflare adapter is used? is there any case in which you would prefer to stay on 18?
The best thing might be for Cloudflare to start using a newer version of Node by default.
yes... I totally get that... but we can't really just bump the version in the build image as it would potentially break users (e.g. someone could be able to deploy the same exact project today but not tomorrow)
this is something that the team is very against with as it would make for a poor/unstable DX
the only way to address this is to have a new v3
build image and set that as the default for newer projects (exactly as we did for v2
). Unfortunately we don't want to do that too often either as it requires a bunch of extra maintenance burden on our side (+ the extra UI clatter for users I guess)
we'll definitely do that at some point! but I don't think that's going to happen soon 😓 (@walshydev do you know if there are any plans for a v3
?)
@benmccann could you add an .npmrc to always just use a higher node version when the cloudflare adapter is used? is there any case in which you would prefer to stay on 18?
That would be the easiest solution, but users setup the adapter, so they'd be responsible for doing it. I think the most we can do is document that it's recommended to do so.
@benmccann could you add an .npmrc to always just use a higher node version when the cloudflare adapter is used? is there any case in which you would prefer to stay on 18?
That would be the easiest solution, but users setup the adapter, so they'd be responsible for doing it. I think the most we can do is document that it's recommended to do so.
It's worth noting that adapter-auto also wouldn't be as seamless in this case
@WalshyDev do you know if there are any plans for a v3?
Not aware of any near-term plans.
I just ran into this and setting the .node-version
file to 18.18.0
and the Cloudflare NODE_VERSION
env var to 18
did not solve the issue. As an alternate solution, if you're not specifically dependent on eslint for some reason, completely removing eslint and adding oxlint https://oxc.rs/docs/guide/usage/linter to an adapter-cloudflare
project deploys to Cloudflare without issue using either Node 18 or Node 20.
You don't need to set the ENV variable, you can just set the .node-version
file to ^18.18.0
. One or the other.
J
Describe the bug
I'm having issues deploying a SvelteKit app using
@sveltejs/adapter-cloudflare
with Typescript and ESLint. When trying to deploy the site I get this error:Reproduction
Reproduction: https://github.com/fmaclen/cloudflare-adapter-dependencies
Here are the settings I chose to generate the repository:
Logs
No response
System Info
Severity
blocking all usage of SvelteKit
Additional Information
The site is not deployable with the current library versions set by
npm create svelte@latest
command.