From 9f8d8526b242e026e7a87ee22094231a8e7e12b1 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Tue, 8 Dec 2015 13:49:36 -0500 Subject: [PATCH] Framework: Pass global npm root to require semver Since `semver` is not default to node but is included in any npm installation --- Makefile | 2 +- bin/check-node-version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ce980d06bc0a9c..a59d9641191259 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ run: welcome githooks-commit install build @$(NODE) build/bundle-$(CALYPSO_ENV).js node-version: - @$(BIN)/check-node-version + @NPM_GLOBAL_ROOT=$(shell $(NPM) -g root) $(BIN)/check-node-version # a helper rule to ensure that a specific module is installed, # without relying on a generic `npm install` command diff --git a/bin/check-node-version b/bin/check-node-version index c574acad93404a..557712afa8a626 100755 --- a/bin/check-node-version +++ b/bin/check-node-version @@ -1,6 +1,6 @@ #!/usr/bin/env node const requiredVersion = require( '../package' ).engines.node, - semver = require( 'semver' ); + semver = require( process.env.NPM_GLOBAL_ROOT + '/npm/node_modules/semver' ); if ( ! semver.satisfies( process.version, requiredVersion ) ) { console.error( 'wp-calypso requires node ' + requiredVersion + '. Please upgrade! See https://nodejs.org for instructions.' );