mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 17:58:07 +00:00
23 lines
738 B
JavaScript
23 lines
738 B
JavaScript
'use strict';
|
|
|
|
const { red, green, bold } = require('chalk');
|
|
const semver = require('semver');
|
|
|
|
module.exports = function checkBeforeInstall() {
|
|
const currentNodeVersion = process.versions.node;
|
|
const minNodeVersion = '14.19.1'; // greater than or equal to this
|
|
const maxNodeVersion = '17.0.0'; // less than this
|
|
|
|
if (
|
|
!semver.gte(currentNodeVersion, minNodeVersion) ||
|
|
!semver.lt(currentNodeVersion, maxNodeVersion)
|
|
) {
|
|
console.error(red(`You are running ${bold(`node ${currentNodeVersion}`)}`));
|
|
console.error(
|
|
`Strapi requires ${bold(green(`node >=${minNodeVersion} and <${maxNodeVersion}`))}`
|
|
);
|
|
console.error('Please make sure to use the right version of Node.');
|
|
process.exit(1);
|
|
}
|
|
};
|