Update check for Node version

This commit is contained in:
Guangcong Luo 2017-06-23 14:28:55 -07:00
parent abfebe0da5
commit ba3016340a
4 changed files with 15 additions and 8 deletions

View File

@ -29,13 +29,13 @@ Installing
./pokemon-showdown
(Requires Node.js 6+)
(Requires Node.js 8+)
Detailed installation instructions
------------------------------------------------------------------------
Pokémon Showdown requires you to have [Node.js][6] installed, 6.x or later.
Pokémon Showdown requires you to have [Node.js][6] installed, 8.x or later (7.7 or later can work, but you might as well be on the latest stable).
Next, obtain a copy of Pokémon Showdown. If you're reading this outside of GitHub, you've probably already done this. If you're reading this in GitHub, there's a "Clone or download" button near the top right (it's green). I recommend the "Open in Desktop" method - you need to install GitHub Desktop which is more work than "Download ZIP", but it makes it much easier to update in the long run (it lets you use the `/updateserver` command).

11
app.js
View File

@ -44,11 +44,18 @@
const FS = require('./fs');
// Check for dependencies
// Check for version and dependencies
try {
// I've gotten enough reports by people who don't use the launch
// script that this is worth repeating here
eval('{ let a = async () => {}; }');
} catch (e) {
throw new Error("We require Node.js version 8 or later; you're using " + process.version);
}
try {
require.resolve('sockjs');
} catch (e) {
throw new Error('Dependencies are unmet; run node pokemon-showdown before launching Pokemon Showdown again.');
throw new Error("Dependencies are unmet; run node pokemon-showdown before launching Pokemon Showdown again.");
}
/*********************************************************

View File

@ -15,7 +15,7 @@
"ofe": "0.5.1"
},
"engines": {
"node": ">=6.0.0"
"node": ">=7.7.0"
},
"main": "app.js",
"scripts": {

View File

@ -5,12 +5,12 @@ const child_process = require('child_process');
const fs = require('fs');
const path = require('path');
// Make sure we're Node 6+
// Make sure we're Node 8+
try {
eval('{ let [a] = [1]; }');
eval('{ let a = async () => {}; }');
} catch (e) {
console.log("We require Node.js v6 or later; you're using " + process.version);
console.log("We require Node.js version 8 or later; you're using " + process.version);
process.exit(1);
}