Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit eeb9ef0

Browse files
chore(gruntfile): check the node version before starting
We specify the node version that is required to run the build in the `.nvmrc` file. So let's check that the current node version satisfies this and report a helpful message if it is not.
1 parent a6118df commit eeb9ef0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Gruntfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ var versionInfo = require('./lib/versions/version-info');
99
var path = require('path');
1010
var e2e = require('./test/e2e/tools');
1111

12+
var semver = require('semver');
13+
var fs = require('fs');
14+
15+
var useNodeVersion = fs.readFileSync('.nvmrc', 'utf8');
16+
if (!semver.satisfies(process.version, useNodeVersion)) {
17+
throw new Error('Invalid node version; please use node v' + useNodeVersion);
18+
}
19+
1220
module.exports = function(grunt) {
1321
//grunt plugins
1422
require('load-grunt-tasks')(grunt);

0 commit comments

Comments
 (0)