From 7549c1f8e61a8131db09420e84d2fe8607b0591d Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Fri, 7 Sep 2018 16:28:03 -0500 Subject: [PATCH] require.resolve() should start by looking in embark's own node_modules --- lib/modules/blockchain_process/simulator.js | 3 ++- lib/modules/code_generator/index.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/modules/blockchain_process/simulator.js b/lib/modules/blockchain_process/simulator.js index a47fd7317..6e0e848cf 100644 --- a/lib/modules/blockchain_process/simulator.js +++ b/lib/modules/blockchain_process/simulator.js @@ -5,6 +5,7 @@ let proxy = require('./proxy'); const Ipc = require('../../core/ipc'); const constants = require('../../constants.json'); const {defaultHost, dockerHostSwap} = require('../../utils/host'); +const fs = require('../../core/fs.js'); class Simulator { constructor(options) { @@ -15,7 +16,7 @@ class Simulator { run(options) { let cmds = []; - const ganache_main = require.resolve('ganache-cli'); + const ganache_main = require.resolve('ganache-cli', {paths: fs.embarkPath('node_modules')}); const ganache_json = pkgUp.sync(path.dirname(ganache_main)); const ganache_root = path.dirname(ganache_json); const ganache_bin = require(ganache_json).bin; diff --git a/lib/modules/code_generator/index.js b/lib/modules/code_generator/index.js index 6b4920844..6fe170d61 100644 --- a/lib/modules/code_generator/index.js +++ b/lib/modules/code_generator/index.js @@ -289,7 +289,7 @@ class CodeGenerator { function getWeb3Location(next) { self.events.request("version:get:web3", function(web3Version) { if (web3Version === "1.0.0-beta") { - return next(null, require.resolve("web3")); + return next(null, require.resolve("web3", {paths: fs.embarkPath("node_modules")})); } self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) { return next(null, fs.dappPath(location)); @@ -350,7 +350,7 @@ class CodeGenerator { function getWeb3Location(next) { self.events.request("version:get:web3", function(web3Version) { if (web3Version === "1.0.0-beta") { - return next(null, require.resolve("web3")); + return next(null, require.resolve("web3", {paths: fs.embarkPath("node_modules")})); } self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) { return next(null, fs.dappPath(location));