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

doesn't resolve to latest satisfied version #7543

Closed
2 of 4 tasks
tjx666 opened this issue Jan 20, 2024 · 4 comments
Closed
2 of 4 tasks

doesn't resolve to latest satisfied version #7543

tjx666 opened this issue Jan 20, 2024 · 4 comments

Comments

@tjx666
Copy link

tjx666 commented Jan 20, 2024

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

8.14.1

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://stackblitz.com/~/github.com/tjx666/mono-project

Reproduction steps

  1. open https://stackblitz.com/~/github.com/tjx666/mono-project
  2. pnpm install, packages/pkg1 will install @yutengjing/foo v1.0.0 because of the lockfile
  3. rm pnpm-lockfile.yaml
  4. pnpm install, packages/pkg1 should install @yutengjing/foo v1.0.2 but still install v1.0.0
  5. If I remove node_modules first and then remove pnpm-lock.yaml, pnpm install, will install correctlly

Describe the Bug

When I remove lockfile, and reinstall, packages/pkg1 still install v1.0.0

Seems affected by the node_modules. If I remove the node_modules, everythings ok.

Expected Behavior

should install @yutengjing/foo v1.0.2. Because I decalre the version by ^1.0.0, and the latest version is v1.0.2.

Which Node.js version are you using?

18.8

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

No response

@zkochan
Copy link
Member

zkochan commented Jan 21, 2024

So why don't you run pnpm update if you want to update a dependency? This behaviour seems correct to me. Why should pnpm change an existing node_modules only because you remove the lockfile?

@tjx666
Copy link
Author

tjx666 commented Jan 22, 2024

In my opinion, when I remove lockfile, the install result should be the same whether or not the node_modules exits. node_modules shouldn't affect the install result.

pnpm update is the better way to update deps, but many people include me all know remove the lockfile will make the deps to update...

@zkochan
Copy link
Member

zkochan commented Jan 22, 2024

but many people include me all know remove the lockfile will make the deps to update...

I am not sure what made you believe that. Historically, npm didn't even have a lockfile by default and running npm install repeatadely didn't update node_modules. That's what the update command is for. Some users still don't use a lockfile, they set the lockfile setting to false, so running update on repeat install doesn't seem like the right solution.

That said, I don't know what most people would expect. However, I think this is the first time I hear about this expectation.

@tjx666
Copy link
Author

tjx666 commented Jan 23, 2024

I'm wrting a article about how pnpm resolve duplicate deps, I think pnpm will update to latest satified verison when there is no lockfile. But after test, I find it will be affted by node_module cache.

@zkochan zkochan closed this as completed Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants