Cloudflare ignores NODE_VERSION

Next.JS 15 requires nodejs version 18.18.0, but Cloudflare's is 18.17.1 When I change NODE_VERSION env variable, it just does not change it.
11 Replies
Walshy
Walshy14mo ago
it's picking it up from a file check you don't have an nvmrc, it configured in package.json or a .node-version file
Jakov
JakovOP14mo ago
Do I have to create .nvmrc? And what should I set contents of it to? How can I create nvmrc
Walshy
Walshy14mo ago
i mean i'm saying you may have one of those files not make one
Jakov
JakovOP14mo ago
I dont
Walshy
Walshy14mo ago
it's picking it up from some file what's your package.json?
Jakov
JakovOP14mo ago
{
"name": "cubing-competition",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbo --port 2500",
"build": "next build",
"start": "next start --port 2500",
"lint": "tsc && next lint --fix && stylelint \"**/*.css\" --fix && markdownlint **/*.md -f --ignore node_modules",
"format": "prettier . --write",
"check-code": "pnpm run format && pnpm run lint",
"pages:build": "pnpx @cloudflare/next-on-pages",
"preview": "pnpm run pages:build && wrangler pages dev",
"deploy": "pnpm run pages:build && wrangler pages deploy"
},
"dependencies": {
"clsx": "^2.1.1",
"dompurify": "^3.1.7",
"framer-motion": "^11.11.9",
"next": "15.0.0",
"react": "19.0.0-rc-45804af1-20241021",
"react-dom": "19.0.0-rc-45804af1-20241021",
"react-error-boundary": "^4.1.2",
"react-query": "^3.39.3",
"react-select": "^5.8.1",
"scramble-display": "^0.5.5",
"sharp": "^0.33.5"
},
"devDependencies": {
"@cloudflare/next-on-pages": "^1.13.5",
"@types/dompurify": "^3.0.5",
"@types/node": "^22.7.8",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"eslint": "^9.13.0",
"eslint-config-next": "15.0.0",
"eslint-plugin-next-on-pages": "^1.13.5",
"markdownlint-cli": "^0.42.0",
"stylelint": "^16.10.0",
"stylelint-config-standard": "^36.0.1",
"typescript": "^5.6.3"
}
}
{
"name": "cubing-competition",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbo --port 2500",
"build": "next build",
"start": "next start --port 2500",
"lint": "tsc && next lint --fix && stylelint \"**/*.css\" --fix && markdownlint **/*.md -f --ignore node_modules",
"format": "prettier . --write",
"check-code": "pnpm run format && pnpm run lint",
"pages:build": "pnpx @cloudflare/next-on-pages",
"preview": "pnpm run pages:build && wrangler pages dev",
"deploy": "pnpm run pages:build && wrangler pages deploy"
},
"dependencies": {
"clsx": "^2.1.1",
"dompurify": "^3.1.7",
"framer-motion": "^11.11.9",
"next": "15.0.0",
"react": "19.0.0-rc-45804af1-20241021",
"react-dom": "19.0.0-rc-45804af1-20241021",
"react-error-boundary": "^4.1.2",
"react-query": "^3.39.3",
"react-select": "^5.8.1",
"scramble-display": "^0.5.5",
"sharp": "^0.33.5"
},
"devDependencies": {
"@cloudflare/next-on-pages": "^1.13.5",
"@types/dompurify": "^3.0.5",
"@types/node": "^22.7.8",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"eslint": "^9.13.0",
"eslint-config-next": "15.0.0",
"eslint-plugin-next-on-pages": "^1.13.5",
"markdownlint-cli": "^0.42.0",
"stylelint": "^16.10.0",
"stylelint-config-standard": "^36.0.1",
"typescript": "^5.6.3"
}
}
Is this the reason maybe?
Walshy
Walshy14mo ago
hmm no well, you can add engines yourself, i think package.json is the highest presidence "engines": { "node": "20.18.0" }
Jakov
JakovOP14mo ago
I added
"engines": {
"node": ">=20.18.0"
},
"engines": {
"node": ">=20.18.0"
},
I'm waiting Nope @Walshy | Out of office Sorry for the ping, any ideas? I'm bumping this I'm bumping
M4JOR
M4JOR14mo ago
It takes those info from package-lock.json in your case from pnpm-lock.yaml I guess where there's mentioning of engines and node version requirements for each packages
᲼᲼
᲼᲼14mo ago
I cannot post post but how do i fix error 1068?? on the services srry i cannot post sorry I need help
M4JOR
M4JOR14mo ago
I too tried deploying my sveltekit app today and faced similar problem. I tried mentioning engines in package.json file and a also tried mentioning in .node-version file. but this seem to work for me so far. https://developers.cloudflare.com/pages/configuration/build-image/#overriding-default-versions (2. Add the environment variable on the dashboard by going to Settings > Environmnet variables in your Pages project, or add the environment variable via Wrangler.) however the npm version is still default old one(I thought it would be corresponding based on the mentioned node version, that's whats mentioned in docs )

Did you find this page helpful?