I have 1 specific function that errors with
For me though, I want to do the opposite, I want to upgrade Netlify’s Node version to 14 instead of using 12.
Locally it doesn’t error and I’m using the versions:
On Netlify’s build image selection I am using
Ubuntu Xenial 16.04 (default) which uses
v12.x by default.
To select your own Node version you can do many things like
NODE_VERSION, etc., I choose both the options I mentioned above with the same version I am using
v14.17.0. According to Netlify, they use the Amazon Lambdas which has support for Node 14.x.
My build was published successfully had this to say:
2:17:02 AM: Attempting node version 'v14.17.0' from .nvmrc 2:17:02 AM: Downloading and installing node v14.17.0... 2:17:02 AM: Downloading https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz... 2:17:03 AM: Computing checksum with sha256sum 2:17:03 AM: Checksums matched! 2:17:06 AM: Now using node v14.17.0 (npm v6.14.13)
So we are in fact forcing Netlify Node to use the same Node version I am using locally. The project also uses the correct version of Yarn. Now that everything is identical, environment wise, build-step wise, code-wise… I am still getting the
Runtime.UserCodeSyntaxError on that 1 specific function that uses this code syntax:
const test = obj?.obj2?.obj3?.test
I know Node 14.x supports this new style and 12.x doesn’t but even my Netlify deploy logs tell me its using Node 14.x.
What is wrong here?