diff options
Diffstat (limited to 'lib/utils/unsupported.js')
-rw-r--r-- | lib/utils/unsupported.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/utils/unsupported.js b/lib/utils/unsupported.js index 5f6a341a8..75aad5e78 100644 --- a/lib/utils/unsupported.js +++ b/lib/utils/unsupported.js @@ -1,7 +1,14 @@ +/* eslint-disable no-console */ const semver = require('semver') const supported = require('../../package.json').engines.node const knownBroken = '<6.2.0 || 9 <9.3.0' +// Keep this file compatible with all practical versions of node +// so we dont get syntax errors when trying to give the users +// a nice error message. Don't use our log handler because +// if we encounter a syntax error early on, that will never +// get displayed to the user. + const checkVersion = exports.checkVersion = version => { const versionNoPrerelease = version.replace(/-.*$/, '') return { @@ -24,10 +31,9 @@ exports.checkForBrokenNode = () => { exports.checkForUnsupportedNode = () => { const nodejs = checkVersion(process.version) if (nodejs.unsupported) { - const log = require('npmlog') - log.warn('npm', 'npm does not support Node.js ' + process.version) - log.warn('npm', 'You should probably upgrade to a newer version of node as we') - log.warn('npm', "can't make any promises that npm will work with this version.") - log.warn('npm', 'You can find the latest version at https://nodejs.org/') + console.error('npm does not support Node.js ' + process.version) + console.error('You should probably upgrade to a newer version of node as we') + console.error("can't make any promises that npm will work with this version.") + console.error('You can find the latest version at https://nodejs.org/') } } |