feat: check expectated node version

This commit is contained in:
NicoPennec 2018-01-30 02:57:24 +01:00
parent f15eb9efa7
commit ff8ffb9592
3 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,8 @@
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
const { join } = require('path')
const { name, engines } = require('../package.json')
const semver = require('semver')
const { Utils } = require('..')
// Global error handler
@ -11,6 +13,10 @@ process.on('unhandledRejection', _error => {
Utils.printError(_error)
})
if (!semver.satisfies(process.version, engines.node)) {
Utils.fatalError(`The engine "node" is incompatible with ${name}. Expected version "${engines.node}".`)
}
const defaultCommand = 'dev'
const commands = new Set([defaultCommand, 'init', 'build', 'start', 'generate'])

View File

@ -98,6 +98,7 @@
"postcss-url": "^7.3.0",
"pretty-error": "^2.1.1",
"progress-bar-webpack-plugin": "^1.10.0",
"semver": "^5.5.0",
"serialize-javascript": "^1.4.0",
"serve-static": "^1.13.1",
"server-destroy": "^1.0.1",

View File

@ -6729,7 +6729,7 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"
"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1:
"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"