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.' );