| 27 | * @param {String} minNodeVersion Minimum required Node version |
| 28 | */ |
| 29 | export const enforceMinNodeVersion = (minNodeVersion: string) => { |
| 30 | const currentNodeVersion = process.version; |
| 31 | |
| 32 | // we cannot use template literals, since we still do not know if we are |
| 33 | // running under Node >= 4.0 |
| 34 | if (semver.lt(currentNodeVersion, minNodeVersion)) { |
| 35 | console.error(`Running Etherpad on Node ${currentNodeVersion} is not supported. ` + |
| 36 | `Please upgrade at least to Node ${minNodeVersion}`); |
| 37 | process.exit(1); |
| 38 | } |
| 39 | |
| 40 | console.debug(`Running on Node ${currentNodeVersion} ` + |
| 41 | `(minimum required Node version: ${minNodeVersion})`); |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | * Prints a warning if running on a supported but deprecated Node version |