Skip to content

Commit 14b96df

Browse files
authored
fix: find cwd using getProjectRootPath for detecting package manager (#8941)
1 parent c3ff430 commit 14b96df

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.changeset/old-shrimps-invite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix: find cwd using getProjectRootPath for detecting package manager

packages/app-builder-lib/src/node-module-collector/packageManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function hasGlobalInstallation(pm: PM): Promise<boolean> {
1818
return Promise.resolve(globalInstallationCache.get(key)!)
1919
}
2020

21-
return exec(pm, ["--version"])
21+
return exec(pm, ["--version"], { shell: true })
2222
.then(res => {
2323
return /^\d+.\d+.\d+$/.test(res)
2424
})
@@ -87,7 +87,7 @@ export const detect = async ({ cwd, includeGlobalBun }: { cwd?: string; includeG
8787
}
8888

8989
export function getPackageManagerVersion(pm: PM) {
90-
return exec(pm, ["--version"]).then(res => res.trim())
90+
return exec(pm, ["--version"], { shell: true }).then(res => res.trim())
9191
}
9292

9393
export function clearCache() {

packages/app-builder-lib/src/util/yarn.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ async function installDependencies(config: Configuration, appDir: string, option
9696
const arch = options.arch || process.arch
9797
const additionalArgs = options.additionalArgs
9898

99-
log.info({ platform, arch, appDir }, `installing production dependencies`)
100-
const pm = await detect({ cwd: appDir })
99+
const projectDir = await getProjectRootPath(appDir)
100+
const pm = await detect({ cwd: projectDir })
101+
log.info({ pm, platform, arch, projectDir, appDir }, `installing production dependencies`)
101102
const execArgs = ["install"]
102103
const isYarnBerry = await checkYarnBerry(pm)
103104
if (!isYarnBerry) {

0 commit comments

Comments
 (0)