Merge pull request #2718 from NicoPennec/dev

feat: check expectated node version
This commit is contained in:
Sébastien Chopin 2018-01-30 10:17:55 +01:00 committed by GitHub
commit e462f47be3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,8 @@
process.env.DEBUG = process.env.DEBUG || 'nuxt:*' process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
const { join } = require('path') const { join } = require('path')
const { name, engines } = require('../package.json')
const semver = require('semver')
const { Utils } = require('..') const { Utils } = require('..')
// Global error handler // Global error handler
@ -11,6 +13,10 @@ process.on('unhandledRejection', _error => {
Utils.printError(_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 defaultCommand = 'dev'
const commands = new Set([defaultCommand, 'init', 'build', 'start', 'generate']) const commands = new Set([defaultCommand, 'init', 'build', 'start', 'generate'])

View File

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

View File

@ -6729,7 +6729,7 @@ semver-diff@^2.0.0:
dependencies: dependencies:
semver "^5.0.3" 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" version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"