Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

added script to warn users when they are not using correct node version #193

Benjaminba37fad32c13
diff --git a/package.json b/package.json
index c364de4c1..397f0484a 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,8 @@
},
"scripts": {
"test": "grunt test lint",
- "start": "node ./bin/www"
+ "start": "node ./bin/www",
+ "preinstall": "node version-check.js"
},
"devDependencies": {
"babel-polyfill": "6.16.0",
diff --git a/version-check.js b/version-check.js
new file mode 100644
index 000000000..691b9a671
--- /dev/null
+++ b/version-check.js
@@ -0,0 +1,10 @@
+var packageJson = require('./package.json');
+var requiredVersion = 'v' + packageJson.engines.node;
+var nodeBeingUsed = process.version;
+
+if(requiredVersion != nodeBeingUsed ) {
+ console.log('\x1b[31m', '\x1b[1m'); // Added styling to warn
+ console.log('WARN ','\x1b[0m','The suggested version of node for the installation of Worldview is', '\x1b[32m', '\x1b[1m', requiredVersion, '\x1b[0m', ' you are using', '\x1b[32m', '\x1b[1m', nodeBeingUsed);
+ console.log('\x1b[0m', 'If you have difficulties installing Worldview, please try using the install again using the node version','\x1b[32m','\x1b[1m', requiredVersion, '\x1b[0m');
+}
+