Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Node 16 #7417

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [14.x, 16.x]
mongodb-version: [4.2, 4.4]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.15.3
16.15.0
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ Older versions of the browsers might work, but are untested.

Some features may not work with devices/browsers on the older end of these requirements.

## Windows installation software requirements:
## Installation software requirements:

- [Node.js](http://nodejs.org/) Latest Node 12 LTS. Node versions that do not have the latest security patches will not work. Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `bin/setup.sh`)
- [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) 3.x or later. MongoDB 2.4 is only supported for Raspberry Pi.
- [Node.js](http://nodejs.org/) Latest Node 14 LTS or Node 16 LTS. Node versions that do not have the latest security patches will not work. Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `bin/setup.sh`)
- [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) 4.2 or 4.4 or 5.0

As a non-root user clone this repo then install dependencies into the root of the project:

Expand All @@ -184,7 +184,7 @@ $ npm install

- If deploying the software to Microsoft Azure, you must set ** in the app settings for *WEBSITE_NODE_DEFAULT_VERSION* and *SCM_COMMAND_IDLE_TIMEOUT* **before** you deploy the latest Nightscout or the site deployment will likely fail. Other hosting environments do not require this setting. Additionally, if using the Azure free hosting tier, the installation might fail due to resource constraints imposed by Azure on the free hosting. Please set the following settings to the environment in Azure:
```
WEBSITE_NODE_DEFAULT_VERSION=10.15.2
WEBSITE_NODE_DEFAULT_VERSION=16.15.0
SCM_COMMAND_IDLE_TIMEOUT=300
```
- See [install MongoDB, Node.js, and Nightscouton a single Windows system](https://github.com/jaylagorio/Nightscout-on-Windows-Server). if you want to host your Nightscout outside of the cloud. Although the instructions are intended for Windows Server the procedure is compatible with client versions of Windows such as Windows 7 and Windows 10.
Expand Down
2 changes: 1 addition & 1 deletion azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
},
"WEBSITE_NODE_DEFAULT_VERSION": {
"type": "string",
"defaultValue": "8.11.1"
"defaultValue": "16.15.0"
}
},
"resources": [{
Expand Down
20 changes: 14 additions & 6 deletions lib/server/bootevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function boot (env, language) {

//////////////////////////////////////////////////
// Check Node version.
// Latest Node 10 to 14 LTS are recommended and supported.
// Older Node versions or Node versions with known security issues will not work.
// Latest Node 16 LTS is recommended and supported.
// Older Node versions or Node versions with known security issues, or without support of NodeJS.org will not work.
///////////////////////////////////////////////////
function checkNodeVersion (ctx, next) {

Expand All @@ -35,15 +35,23 @@ function boot (env, language) {

const isLTS = process.release.lts ? true : false;

if (isLTS && (semver.satisfies(nodeVersion, '^14.0.0') || semver.satisfies(nodeVersion, '^12.0.0') || semver.satisfies(nodeVersion, '^10.0.0'))) {
//Latest Node 10 LTS and Node 12 LTS are recommended and supported.
//Require at least Node 8 LTS and Node 10 LTS without known security issues
if (isLTS && (semver.satisfies(nodeVersion, '^16.15.0') || semver.satisfies(nodeVersion, '^14.19.1') )) {
//Latest Node 16 LTS is recommended and supported.
//Latest Node 14 LTS is supported
//Require at least Node 14 or Node 16 LTS without known security issues
console.debug('Node LTS version ' + nodeVersion + ' is supported');
next();
return;
}

console.log( 'ERROR: Node version ' + nodeVersion + ' is not supported. Please use a secure LTS version or upgrade your Node');
if (semver.satisfies(nodeVersion, '^18.0.0')) {
//Latest Node 18 is used for CI. It is not recommended nor supported.
console.debug('Node version ' + nodeVersion + ' should work, but is currently not supported');
next();
return;
}

console.log( 'ERROR: Node version ' + nodeVersion + ' is not supported. Please use a secure LTS version and upgrade your Node');
process.exit(1);

}
Expand Down
Loading