Question

DigitalOcean App Node.js Version less than 15

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.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Jon Friesen
DigitalOcean Employee
DigitalOcean Employee badge
October 21, 2020
Accepted Answer

👋 @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" 
  }
}

FYI; Node 16 is available through apps now

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.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel