I am trying to deploy a Node.js app but getting errors that the node version is not supported by dependencies (they support node 12-14 and the server appears to be running node 15). Is there any way other than using a custom docker container deploy to specify the node version? I don’t see any way to do it in the app.yaml file or any documentation as to the environment_slug to use for different node versions.

edited by crashoverride

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

đź‘‹ @bherbruck

This is configurable in your package.json file use the engines property. More info here

Here is an example of the engines property for the current Node LTS version:

  "engines" : { 
    "node" : "12.19.0" 

Here is another example of the engines property that span between inclusive Node versions v12 to v14:

  "engines" : { 
    "node" : ">=12.0.0 <=14.0.0" 

Ubuntu 18.04 contains a version of Node.js in its default repositories that can be used to provide a consistent experience across multiple systems. At the time of writing, the version in the repositories is 8.10.0. This will not be the latest version, but it should be stable and sufficient for quick experimentation with the language.

To get this version, you can use the apt package manager. Refresh your local package index by typing:

sudo apt update
Install Node.js from the repositories:

sudo apt install nodejs
If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you’ll also want to install npm, the Node.js package manager. You can do this by typing:

sudo apt install npm
This will allow you to install modules and packages to use with Node.js.

Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejs instead of node. Keep this in mind as you are running software.

To check which version of Node.js you have installed after these initial steps, type:

nodejs -v
Once you have established which version of Node.js you have installed from the Ubuntu repositories, you can decide whether or not you would like to work with different versions, package archives, or version managers.