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] Internal Error "Cannot find installed dependency" with PNPM 5 #2542

Closed
m4ss1m0g opened this issue Mar 9, 2021 · 11 comments
Closed

[rush] Internal Error "Cannot find installed dependency" with PNPM 5 #2542

m4ss1m0g opened this issue Mar 9, 2021 · 11 comments
Labels
bug Something isn't working as intended repro confirmed The issue comments included repro instructions, and the maintainers reproduced the problem

Comments

@m4ss1m0g
Copy link

m4ss1m0g commented Mar 9, 2021

Summary

[rush] Using rush update twice raise

ERROR: Internal Error: Cannot find installed dependency "@nestjs/common" in
"c:\xxx\node_modules"
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.

Repro steps

  1. Download the attached solution rush-nest.zip
  2. run rush install
  3. run rush update

Details

The error raised says about the @nestjs/common package on data project which is the same installed on ui project.
The objective is to write a custom service with @Injectable() attribute on a separate project.

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.40.7
rushVersion from rush.json? 5.40.7
useWorkspaces from rush.json? false
Operating system? Windows
Would you consider contributing a PR? No
Node.js version (node -v)? v12.21.0
@octogonz octogonz added bug Something isn't working as intended repro confirmed The issue comments included repro instructions, and the maintainers reproduced the problem labels Mar 10, 2021
@octogonz
Copy link
Collaborator

This is a bug. I have seen it before. Having a repro is very helpful, thanks!

The rush update command performs a minimal update of your pnpm-lockfile.yaml to satisfy new package.json requirements for your projects. Developers prefer this minimal update because it avoids having to deal with potential breaks caused by new versions of dependencies that are unrelated to the work in their PR. However, if everyone always uses rush update, then eventually your pnpm-lockfile.yaml will incrementally become weirder and weirder until it no longer represents a typical clean installation. Then we encounter whatever obscure edge is causing this Rush bug.

The simple workaround is to run rush update --full, which will put you back into a normal pnpm-lockfile.yaml. I confirmed that this fixes your repro.

Ideally, someone should be running rush update --full regularly (weekly?) in your monorepo, maybe as its own PR so that versioning breaks can be handled in isolation. But from what I've seen, in an active repo this will happen by itself, because the people who are repo maintainers will come to prefer to always do rush update --full in their own PRs, because they are interested in catching these kinds of problems.

Another option is to enable useWorkspaces=true in rush.json, which I believe completely eliminates the Rush code path that has this bug. useWorkspaces is technically still "experimental" but it is widely used and now very stable. It will be on by default in the next major Rush release. But even if you do this, it's still recommended to run rush update --full regularly.

I wonder if we should document this better.

@m4ss1m0g
Copy link
Author

Thanks for the fasten response, I try either the rush update --full and the useWorkspaces=true, and both fixed the problem.
You can close the issue if you want.

@octogonz
Copy link
Collaborator

I think we should at the very least improve the docs. If we can't fix the bug easily, we could change the error message to give more useful advice than You have encountered a software defect.

@m1heng
Copy link
Contributor

m1heng commented Mar 20, 2021

I think we should at the very least improve the docs. If we can't fix the bug easily, we could change the error message to give more useful advice than You have encountered a software defect.

Or maybe a message with more certain information targeting this issue? Software defect really doesn't give any information for next step.

@octogonz
Copy link
Collaborator

octogonz commented Apr 14, 2021

@iclanton we are hearing about this issue a lot lately. I think we should bump the priority for investigating it. If there isn't an easy fix, maybe we could at least improve the error message to direct people to the known workarounds.

👉 Note that this same error message is reported (for completely different reasons) when using PNPM 6. Issue #2601 is tracking the PNPM 6 incompatibility.

@octogonz octogonz changed the title [rush] Cannot find installed dependency on rush update [rush] Internal Error "Cannot find installed dependency" with PNPM 5 Apr 14, 2021
@jeremymeng
Copy link
Member

I upgraded pnpm to v7 and encountered this error. rush update --full didn't fix the problem for me. To repro check out this branch then run rush update --full

https://github.com/jeremymeng/azure-sdk-for-js/tree/engsys/bump-rush-pnpm-version

@jeremymeng
Copy link
Member

Just noticed that this issue is for PNPM 5. Should I log a new issue for PNPM 7 @octogonz?

@octogonz
Copy link
Collaborator

octogonz commented Jun 4, 2022

@jeremymeng are you using useWorkspaces=true?

@jeremymeng
Copy link
Member

@jeremymeng are you using useWorkspaces=true?

@octogonz No, we did attempt to to use useWorkspaces=true in our repo before but ran into issues that we couldn't resolve easily.

@fringd
Copy link

fringd commented Jun 23, 2022

I'm seeing this too with latest rush and pnpm, 5.74.0 and 7.30 respectively

@mikaelmattsson
Copy link

Team mate had the same issue. useWorspaces fixed it.

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 repro confirmed The issue comments included repro instructions, and the maintainers reproduced the problem
Projects
Archived in project
Development

No branches or pull requests

7 participants
@fringd @mikaelmattsson @m4ss1m0g @octogonz @jeremymeng @m1heng and others