Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fix pnpm-sync caused .modules.yaml ENOENT during install",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
3 changes: 2 additions & 1 deletion libraries/rush-lib/src/logic/base/BaseInstallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,12 @@ export abstract class BaseInstallManager {
if (this.rushConfiguration.isPnpm && experiments?.usePnpmSyncForInjectedDependencies) {
const pnpmLockfilePath: string = subspace.getTempShrinkwrapFilename();
const dotPnpmFolder: string = `${subspace.getSubspaceTempFolderPath()}/node_modules/.pnpm`;
const modulesFilePath: string = `${subspace.getSubspaceTempFolderPath()}/node_modules/.modules.yaml`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally pnpm-sync-lib should export this as a constant. But it's not essential.


// we have an edge case here
// if a package.json has no dependencies, pnpm will still generate the pnpm-lock.yaml but not .pnpm folder
// so we need to make sure pnpm-lock.yaml and .pnpm exists before calling the pnpmSync APIs
if ((await FileSystem.existsAsync(pnpmLockfilePath)) && (await FileSystem.existsAsync(dotPnpmFolder))) {
if ((await FileSystem.existsAsync(pnpmLockfilePath)) && (await FileSystem.existsAsync(dotPnpmFolder)) && (await FileSystem.existsAsync(modulesFilePath))) {
await pnpmSyncPrepareAsync({
lockfilePath: pnpmLockfilePath,
dotPnpmFolder,
Expand Down