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] rush install --only . installs all dependencies in the monorepo instead of only the dependencies in current folder/project #4597

Open
elenasch opened this issue Mar 22, 2024 · 10 comments
Labels
bug Something isn't working as intended

Comments

@elenasch
Copy link

elenasch commented Mar 22, 2024

Summary

The RushJS documentation for rush install states that I can run with --only flag which will select only the one specified project and install only the dependencies for that project. However that doesn't seem the case and all monorepo's projects' dependencies are still getting installed.

Repro steps

To reproduce, run rush purge first, then rush install --only . in any folder, and see what gets installed. You will see that rush installs all monorepo dependencies, and not only the specified project.

It takes a significant amount of time to install and I can see a line line this in logs Scope: 8 of 219 workspace projects and Progress: resolved 3620, reused 3550, downloaded 0, added 3076 in logs.

I tested with rush install --to . as well, and I see this log line Scope: 8 of 219 workspace projects. 8 is the correct number of selected projects as oppose to Scope: all 219 workspace projects generated for rush install

However, watching the installation progress, it always results in Progress: resolved 3620, reused 0, downloaded 3550, added 3076 done --> same amount of packages downloaded and added for any of the flags (or no flags) specified

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.112.2
rushVersion from rush.json? 5.112.2
useWorkspaces from rush.json? true
Operating system? MacOS
Would you consider contributing a PR? No
Node.js version (node -v)? v20.10.0
@iclanton
Copy link
Member

This seems like a recent regression. @dmichon-msft - can you take a look at this, since you refactored the project selection logic? This may have been broken by recent changes to the installation algorithm. @g-chao, @william2958 - Would you two mind taking a look at this as well, as you guys changed this logic most recently?

@octogonz
Copy link
Collaborator

Do we know which Rush version introduced this regression?

@octogonz octogonz added the bug Something isn't working as intended label Mar 25, 2024
@octogonz
Copy link
Collaborator

octogonz commented Mar 27, 2024

Notice that @elenasch cited Rush 5.112.2 which is from December. Is this really a regression? Maybe it is just an edge case.

I'm actually unclear what rush install --only . is meant to do by design. Is it even valid? 🤔

@octogonz
Copy link
Collaborator

It might make sense to forbid the unsafe selectors (--only, --impacted-by, --impacted-by-except) for rush install and rush update.

@dmichon-msft what do you think?

@elenasch
Copy link
Author

Similar issue happens with --to. I can see how --only is not always safe, but -to should be, and installing only a subset of deps would really help reduce the time installing (specifically in CI where you don't have previously installed deps like on local )

@dmichon-msft
Copy link
Contributor

If you run with --debug it should log the command being forwarded to pnpm. Are the --filter arguments not showing up in that command?

@elenasch
Copy link
Author

It looks like it is there. Are there any other settings that look out of place ?

Invoking package manager: <my path>/.rush/node-v20.10.0/pnpm-8.13.1/node_modules/pnpm/bin/pnpm.cjs install --store <my path>/common/temp/pnpm-store --config.cacheDir= <my path>/common/temp/pnpm-store --config.stateDir= <my path>/common/temp/pnpm-store --no-prefer-frozen-lockfile --reporter ndjson --no-strict-peer-dependencies --config.auto-install-peers=false --config.resolutionMode=highest --config.ignoreCompatibilityDb --recursive --link-workspace-packages false --filter my-npm-package...

@elenasch
Copy link
Author

@dmichon-msft I ran just the raw pnpm command I posted above, and it did the right thing with only installing the one project in filter (took about 5.5s) , then ran the rush install --only . and it took ~54s.

@hx-dl
Copy link

hx-dl commented Apr 8, 2024

Similar issue happens with --to. I can see how --only is not always safe, but -to should be, and installing only a subset of deps would really help reduce the time installing (specifically in CI where you don't have previously installed deps like on local )

I encountered a similar problem. After we upgraded pnpm7 to pnpm8, rush install --to projectName no longer installs the dependencies of the project specified by --to. After execution, all dependencies of the entire monorepo are installed. I would like to ask if anyone has the same problem.

rush version: 5.115.0
pnpm version: 8.15.6

If I revert back to pnpm7, everything will be normal.

@Pipo93
Copy link

Pipo93 commented Apr 29, 2024

@hx-dl I encountered the same problem and created an issue last year already which links to the related issue on pnpm side: #4218

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
Status: Needs Investigation
Development

No branches or pull requests

6 participants