From f67e4a03e42f5fc78672a85dbbbbfa945902445c Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 9 Jan 2018 19:56:38 +0000 Subject: [PATCH] CLI: Detect installed Node version --- CliClient/app/main.js | 7 +++++++ CliClient/package-lock.json | 5 +++++ CliClient/package.json | 1 + 3 files changed, 13 insertions(+) diff --git a/CliClient/app/main.js b/CliClient/app/main.js index accf86072..48a901353 100644 --- a/CliClient/app/main.js +++ b/CliClient/app/main.js @@ -3,6 +3,13 @@ // Make it possible to require("/lib/...") without specifying full path require('app-module-path').addPath(__dirname); +const compareVersion = require('compare-version'); +const nodeVersion = process && process.versions && process.versions.node ? process.versions.node : '0.0.0'; +if (compareVersion(nodeVersion, '8.0.0') < 0) { + console.error('Joplin requires Node 8+. Detected version ' + nodeVersion); + process.exit(1); +} + const { app } = require('./app.js'); const Folder = require('lib/models/Folder.js'); const Resource = require('lib/models/Resource.js'); diff --git a/CliClient/package-lock.json b/CliClient/package-lock.json index d25feb94e..3bc662d7a 100644 --- a/CliClient/package-lock.json +++ b/CliClient/package-lock.json @@ -197,6 +197,11 @@ "delayed-stream": "1.0.0" } }, + "compare-version": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz", + "integrity": "sha1-AWLsLZNR9d3VmpICy6k1NmpyUIA=" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", diff --git a/CliClient/package.json b/CliClient/package.json index 3b475f1d7..72a4b603a 100644 --- a/CliClient/package.json +++ b/CliClient/package.json @@ -28,6 +28,7 @@ }, "dependencies": { "app-module-path": "^2.2.0", + "compare-version": "^0.1.2", "follow-redirects": "^1.2.4", "form-data": "^2.1.4", "fs-extra": "^5.0.0",