0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Show message and don't start on unsupported node versions

closes #292
- added engines and enginestrict properties to package.json
- these provide warnings / errors when installing through npm
- added our own check using this info on start, throws a useful error and stops the app if the node version is not supported
- also switched sqlite3 to the latest version and checked it works with various node versions
This commit is contained in:
ErisDS 2013-07-30 10:02:38 +01:00
parent 93f1baec7f
commit 6dd753212f
2 changed files with 22 additions and 3 deletions

View file

@ -5,6 +5,7 @@ var express = require('express'),
when = require('when'), when = require('when'),
_ = require('underscore'), _ = require('underscore'),
colors = require("colors"), colors = require("colors"),
semver = require("semver"),
errors = require('./core/server/errorHandling'), errors = require('./core/server/errorHandling'),
admin = require('./core/server/controllers/admin'), admin = require('./core/server/controllers/admin'),
frontend = require('./core/server/controllers/frontend'), frontend = require('./core/server/controllers/frontend'),
@ -14,6 +15,7 @@ var express = require('express'),
I18n = require('./core/shared/lang/i18n'), I18n = require('./core/shared/lang/i18n'),
filters = require('./core/server/filters'), filters = require('./core/server/filters'),
helpers = require('./core/server/helpers'), helpers = require('./core/server/helpers'),
packageInfo = require('./package.json'),
// ## Custom Middleware // ## Custom Middleware
auth, auth,
@ -199,7 +201,19 @@ when.all([ghost.init(), filters.loadCoreFilters(ghost), helpers.loadCoreHelpers(
ghost.app().listen( ghost.app().listen(
ghost.config().env[process.env.NODE_ENV || 'development'].url.port, ghost.config().env[process.env.NODE_ENV || 'development'].url.port,
ghost.config().env[process.env.NODE_ENV || 'development'].url.host, ghost.config().env[process.env.NODE_ENV || 'development'].url.host,
function() { function () {
// Tell users if their node version is not supported, and exit
if (!semver.satisfies(process.versions.node, packageInfo.engines.node)) {
console.log(
"\n !!! INVALID NODE VERSION !!!\n".red,
"Ghost requires node version".red,
packageInfo.engines.node.yellow,
"as defined in package.json\n".red
);
process.exit(-1);
}
// Remove once software becomes suitably 'ready' // Remove once software becomes suitably 'ready'
console.log( console.log(

View file

@ -6,6 +6,10 @@
"start": "node index", "start": "node index",
"test": "grunt validate --verbose" "test": "grunt validate --verbose"
}, },
"engines": {
"node": ">=0.10.* <0.11.4"
},
"engineStrict": true,
"dependencies": { "dependencies": {
"express": "3.1.2", "express": "3.1.2",
"express-hbs": "0.2.0", "express-hbs": "0.2.0",
@ -15,13 +19,14 @@
"moment": "2.0.0", "moment": "2.0.0",
"underscore": "1.4.4", "underscore": "1.4.4",
"showdown": "0.3.1", "showdown": "0.3.1",
"sqlite3": "git+https://github.com/developmentseed/node-sqlite3.git#6ae402e", "sqlite3": "2.1.14",
"bookshelf": "0.1.9", "bookshelf": "0.1.9",
"knex": "0.1.7", "knex": "0.1.7",
"when": "2.1.1", "when": "2.1.1",
"bcrypt-nodejs": "0.0.3", "bcrypt-nodejs": "0.0.3",
"node-uuid": "1.4.0", "node-uuid": "1.4.0",
"colors": "~0.6.0-1" "colors": "~0.6.0-1",
"semver": "2.1.0"
}, },
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "grunt": "~0.4.1",