Skip to content

Commit

Permalink
Framework: Pass global npm root to require semver
Browse files Browse the repository at this point in the history
Since `semver` is not default to node but is included in any npm
installation
  • Loading branch information
aduth committed Dec 8, 2015
1 parent 697a9ef commit 9f8d852
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/check-node-version
Original file line number Diff line number Diff line change
@@ -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.' );
Expand Down

0 comments on commit 9f8d852

Please sign in to comment.