Package.json engines field is ignored and causes build error

In package.json engines field, node version is defined as 12.14.1. https://docs.npmjs.com/files/package.json#engines

But Netlify build process ignores this information and uses default node version 10.18.1 instead, which causes build error like this:

11:13:49 PM: Finished restoring cached yarn cache
11:13:50 PM: Installing NPM modules using Yarn version 1.17.0
11:13:51 PM: yarn install v1.17.0
11:13:51 PM: [1/5] Validating package.json…
11:13:51 PM: error app_name@1.0.0: The engine “node” is incompatible with this module. Expected version “12.14.1”. Got “10.18.1”
11:13:51 PM: error Found incompatible module.
11:13:51 PM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
11:13:51 PM: Error during Yarn install
11:13:51 PM: Error running command: Build script returned non-zero exit code: 1
11:13:51 PM: failed during stage ‘building site’: Build script returned non-zero exit code: 1
11:13:51 PM: Failing build: Failed to build site
11:13:51 PM: Finished processing build request in 18.084510139s

Please check engines.node and apply correct version before building application. Thanks.

HI, @andre, and welcome to our Netlify community site.

There are a few ways to control the version of node used by the build system. There is more about this in our documentation here:

https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript

Would you try using one of those methods to set the version? If there are other questions about this, please let us know.

Thanks for solving the issue…