Open GenrikhFetischev opened 2 years ago
I don't understand why pnpm changes the lock file after pnpm link
. The package targets a local directory in the lock file, which doesn't make sense to anyone else but me.
It's also quite strange that this ticket didn't get any response for months. Isn't it an obvious problem, or am I missing something? I'm still a rookie to pnpm.
I don't understand why pnpm changes the lock file after pnpm link
So, don't commit the change, what is the problem?
pnpm uses information from the lockfile to understand what the structure of node_modules is. We can't make changes to the node_modules without making changes to the lockfile. I mean, we can, but on next install pnpm would return the node_modules to the state described by the lockfile.
Thanks, @zkochan for answering 👍
What about the issue, is it a bug or expected behavior?
+1 to get this answered, as I'm experiencing this same issue as well.
This is really confusing coming from how yarn
and npm
both work.
Local linking during package development should imho be a completely separate feature from hard-linking a path to a local dependency.
I use a private repo and our org's package repository on github not npmjs BUT I think it would be similar...Given you're .npmrc is set up and you are logged in correctly with a PAT with the correct OAuth scopes:
Does that help you at all?
My only complaint is I still have to publish "npm publish myOrg/myPackage". Suggestions welcome.
I also find that unlink
mostly does not work.
I'm using pnpm install
again to unlink.
How is this still not addressed? It's a serious bug
So, don't commit the change, what is the problem?
It adds an extra step, we have to either roll back the lockfile or make sure to never use git add .
if we have something linked. If retaining links after reinstall is a goal then put that information in a separate file we can gitignore.
I just started experimenting with this. I haven't found that pnpm link ../project
changes my lockfile, but pnpm unlink
doesn't remove any symlinks in my project's node_modules. Weirdly though, passing in anything after pnpm unlink does (e.g., pnpm unlink random args
).
pnpm version: 6.25.1
Code to reproduce the issue:
Expected behavior:
pnpm unlink
reverts changes made bypnpm link
Actual behavior:
Symlink in node_modules directory and changes in pnpm-lock.yaml remain after
pnpm unlink
Additional information:
I tried to use
pnpm link/unlink
commands in two monorepos organized as pnpm workspaces.pnpm link
works as expected and patchespnpm-lock.yaml
, but it looks like unlink command does nothing, so I have to runpnpm install
or reset changes inpnpm-lock.yaml
; whereas I was expectingpnpm unlink
to do that for me. I expectunlink
to revert changes back and according to docs there should be an automatic execution ofpnpm install
command.node -v
prints: v17.1.0