diff --git a/src/config.js b/src/config.js index b0e7afbd57..953ae2c702 100644 --- a/src/config.js +++ b/src/config.js @@ -306,6 +306,10 @@ export default class Config { } } + if (this.modulesFolder) { + this.registryFolders.push(this.modulesFolder); + } + this.networkConcurrency = opts.networkConcurrency || Number(this.getOption('network-concurrency')) || constants.NETWORK_CONCURRENCY; diff --git a/src/package-linker.js b/src/package-linker.js index f60b64f48e..5e7bda54c6 100644 --- a/src/package-linker.js +++ b/src/package-linker.js @@ -313,7 +313,7 @@ export default class PackageLinker { const findExtraneousFiles = async basePath => { for (const folder of this.config.registryFolders) { - const loc = path.join(basePath, folder); + const loc = path.resolve(basePath, folder); if (await fs.exists(loc)) { const files = await fs.readdir(loc); @@ -491,7 +491,12 @@ export default class PackageLinker { topLevelDependencies, async ([dest, {pkg}]) => { if (pkg._reference && pkg._reference.locations.length && pkg.bin && Object.keys(pkg.bin).length) { - const binLoc = path.join(this.config.lockfileFolder, this.config.getFolder(pkg)); + let binLoc; + if (this.config.modulesFolder) { + binLoc = path.join(this.config.modulesFolder); + } else { + binLoc = path.join(this.config.lockfileFolder, this.config.getFolder(pkg)); + } await this.linkSelfDependencies(pkg, dest, binLoc); tickBin(); } diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index f155d30d53..b2e9594dff 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -175,6 +175,9 @@ export async function makeEnv( } pathParts.unshift(path.join(config.linkFolder, binFolder)); pathParts.unshift(path.join(cwd, binFolder)); + if (config.modulesFolder) { + pathParts.unshift(path.join(config.modulesFolder, '.bin')); + } } if (config.scriptsPrependNodePath) {