From 38f570abc096b1042f555b7b646dc4ea10fee06e Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 5 Jun 2018 13:06:51 -0400 Subject: [PATCH] Ensure npm scripts find correct meteor executable. (#9941) In my local development environment, the `meteor` command resolves to my Meteor checkout, and I use `~/.meteor/meteor` explicitly when I want to run a released version of Meteor. If I run ~/.meteor/meteor npm test and the `package.json` file defines an npm `test` script that refers to `meteor`, in my environment this `meteor` won't be the same as the one I used to run `~/.meteor/meteor npm test`, which can introduce weirdness such as pinning the versions of packages in `meteor/packages/non-core`, and all the usual Meteor version inconsistency risks. This commit fixes that problem by prepending the directory that contains the `meteor` (or `meteor.bat`) executable to the `PATH` before running `meteor npm ...` commands. --- tools/cli/dev-bundle-bin-helpers.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/cli/dev-bundle-bin-helpers.js b/tools/cli/dev-bundle-bin-helpers.js index 136f6b0693..ce0ffa13d3 100644 --- a/tools/cli/dev-bundle-bin-helpers.js +++ b/tools/cli/dev-bundle-bin-helpers.js @@ -70,6 +70,10 @@ exports.getEnv = function (options) { var paths = [ // When npm looks for node, it must find dev_bundle/bin/node. path.join(devBundleDir, "bin"), + + // When npm looks for meteor, it should find dev_bundle/../meteor. + path.dirname(devBundleDir), + // Also make available any scripts installed by packages in // dev_bundle/lib/node_modules, such as node-gyp. path.join(devBundleDir, "lib", "node_modules", ".bin")