Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] "Cannot get dependency key for temp project" error during "rush install" #2460

Closed
octogonz opened this issue Jan 29, 2021 · 2 comments · Fixed by #2461
Closed

[rush] "Cannot get dependency key for temp project" error during "rush install" #2460

octogonz opened this issue Jan 29, 2021 · 2 comments · Fixed by #2461
Labels
bug Something isn't working as intended

Comments

@octogonz
Copy link
Collaborator

octogonz commented Jan 29, 2021

Summary

We encountered a bug where rush install sometimes prints this error:

ERROR: Cannot get dependency key for temp project: @rush-temp/new-project

Error: Cannot get dependency key for temp project: @rush-temp/new-project
    at PnpmLinkManager._linkProject (C:\Users\Owner\.rush\node-v14.15.3\rush-5.36.2\node_modules\@microsoft\rush-lib\lib\logic\pnpm\PnpmLinkManager.js:132:19)
    at PnpmLinkManager._linkProjects (C:\Users\Owner\.rush\node-v14.15.3\rush-5.36.2\node_modules\@microsoft\rush-lib\lib\logic\pnpm\PnpmLinkManager.js:69:28)
    at async PnpmLinkManager.createSymlinksForProjects (C:\Users\Owner\.rush\node-v14.15.3\rush-5.36.2\node_modules\@microsoft\rush-lib\lib\logic\base\BaseLinkManager.js:189:9)
    at async PnpmLinkManager.createSymlinksForProjects (C:\Users\Owner\.rush\node-v14.15.3\rush-5.36.2\node_modules\@microsoft\rush-lib\lib\logic\pnpm\PnpmLinkManager.js:58:9)
    at async RushInstallManager.postInstallAsync (C:\Users\Owner\.rush\node-v14.15.3\rush-5.36.2\node_modules\@microsoft\rush-lib\lib\logic\installManager\RushInstallManager.js:492

Repro steps

  1. Add a new project to an existing monorepo, and update another project to depend on it.
  2. Run rush install. This operation completes successfully. The new project is added to common/temp/pnpm-lock.yaml. But note that it is NOT added to common/config/rush/pnpm-lock.yaml.
  3. Run rush install a second time. This time it fails with the above error.

Running rush update does NOT fix the problem. But rush update --recheck does fix the problem.

Details

My theory is that it's incorrect for step 2 to skip updating common/config/rush/pnpm-lock.yaml.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.36.2
rushVersion from rush.json? 5.36.2
useWorkspaces from rush.json? false
Operating system? Windows -->
Would you consider contributing a PR? Yes -->
Node.js version (node -v)?
@octogonz octogonz added the bug Something isn't working as intended label Jan 29, 2021
@octogonz
Copy link
Collaborator Author

@sachinjoseph FYI looks like this was a regression introduced by PR #1367. That PR improved the installation logic so that instead of calculating the temp project folder path (sometimes incorrectly), Rush now queries it from the PNPM shrinkwrap file -- which assumes that every Rush project must appear in the shrinkwrap file. That seems like a reasonable assumption, but actually the original implementation did not have this requirement, and (due to NPM's extremely long installation times back then) it was worthwhile to skip installation for that edge case. We can eliminate that optimization now, though.

I think the fix is to expand _findOrphanedTempProjects() to check for missing entries. I can make a PR to do that.

Unfortunately this doesn't explain @WanderWang's related-seeming issue from the chat room, since he is using PNPM workspaces, which does not invoke rush link.

CC @D4N14L

@octogonz
Copy link
Collaborator Author

Here's a PR: #2461

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant