[BUG] npm unlink breaking change intentional?
Current Behavior:
In a package directory where npm link has been run (to link the package in global node_modules), running npm unlink gives the error must provide a package name to remove. In v6 running npm unlink in this situation would remove the link to the package in global node_modules. In v7 I can run npm unlink -g <package-name> to remove the link in global node_modules so I'm not sure if this is a bug or an intentional deprecation of npm unlink to remove the package from global node_modules?
Expected Behavior:
For npm unlink to remove the link to the package in global node_modules
Steps To Reproduce:
Run npm link && npm unlink in a package directory.
Environment:
- OS: MacOS 10.15.7
- Node: 12.18.3
- npm: 7.0.0-rc.4
Hm, this isn't an intentional change, afaik, and should not be too hard to fix.
You can do this in npm 7 with npm unlink -g, but we just aren't defaulting the -g when no args are specified.
Thanks, I've been using npm unlink -g and like the added -g. Makes it clear what I'm doing. So closing.
I think this should be reopened. At the very least, npm unlink doesn't have a doc page; this issue is the only way of knowing that we should use npm unlink -g instead
Doesn't this break the symmetry between npm link and npm unlink? I'd vote to reopen as well.
at least this issue is in the google results :D thanks for the workaround!
This is the only way we know of needing to add -g, which I think should be indicated in the documentation😀
For me worked
sudo npm link
&&
sudo npm unlink -g <package-name>
package-name is "name" in package.json
Can someone tell me difference between npm unlink and npm unlink -g npm unlink -g is working for me, but the tutorial I am following uses npm unlink
@kgpyi I believe the -g stands for global. I think the reason for all this is because unlink is actually an alias for uninstall so you are uninstalling the package globally.