Getting error building nextjs NODE_VERSION not working?

It seems that the error could be caused by the node version but even if I set NODE_VERSION in both production and preview to 17 or 18 it is still using the 12

I tried with the static and non static and the same error

18:40:43.216 Success: Finished cloning repository files
18:40:43.801 Installing dependencies
18:40:43.809 Python version set to 2.7
18:40:47.173 v12.18.0 is already installed.
18:40:48.318 Now using node v12.18.0 (npm v6.14.4)

I uploaded a pic with the error log and my NODE_VERSION set as 17 but still says now using node 12.18.0

I have also set up the flag nodejs_compat in functions and the date is may of 2023

Any ideas? Thanks

This is the full error

18:41:20.837 go version go1.14.4 linux/amd64
18:41:20.841 Installing missing commands
18:41:20.842 Verify run directory
18:41:20.842 Executing user command: next build && next export
18:41:20.934 /opt/buildhome/repo/node_modules/next/dist/build/index.js:420
18:41:20.935 …pageKeys.app ??
18:41:20.935 ^
18:41:20.935
18:41:20.935 SyntaxError: Unexpected token ‘?’
18:41:20.935 at wrapSafe (internal/modules/cjs/loader.js:1054:16)
18:41:20.936 at Module._compile (internal/modules/cjs/loader.js:1102:27)
18:41:20.936 at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
18:41:20.936 at Module.load (internal/modules/cjs/loader.js:986:32)
18:41:20.936 at Function.Module._load (internal/modules/cjs/loader.js:879:14)
18:41:20.936 at Module.require (internal/modules/cjs/loader.js:1026:19)
18:41:20.937 at require (internal/modules/cjs/helpers.js:72:18)
18:41:20.937 at Object. (/opt/buildhome/repo/node_modules/next/dist/cli/next-build.js:15:55)
18:41:20.937 at Module._compile (internal/modules/cjs/loader.js:1138:30)
18:41:20.938 at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
18:41:20.942 Failed: build command exited with code: 1
18:41:21.764 Failed: error occurred while running build command

I just tried in my pc to set node to 12.18.0 and I am getting the same error, so it is the node version, why is not getting set in my build? :frowning:

OK tried to set up another NODE_VERSION and it seems there is some space somewhere because it allowed me to have 2 NODE_VERSION variables now it is changing the version.

Can someone add a trim in the variables and in the values so there is no problems with this?

1 Like

it’s been on my todo list for like a year…
good reminder though, I’ll try and tackle it tomorrow

2 Likes

Ok finally got the trimming PR for this up, should be live next week.

1 Like