You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Running npm link for 2 packages removes the link to the first package #3568
I'm trying to link 2 packages and I know this worked at some point in the past. The current process is running the following commands one after another
npm link guidemaker
npm link guidemaker-default-template
after the first link guidemaker is linked correctly, but after you run the second link it removes the link to guidemaker and only has the link to guidemaker-ember-template
while I was writing this section I wondered if the problem was running them "one after another" and I tried
npm link guidemaker guidemaker-default-template
which happened to work 🙈
Expected Behavior
I expect that running link twice with two different packages should just link both those packages. It's nice to have the workaround that I described above but this is quite confusing for people.
I know that there are existing issues around running npm install removing links but that isn't related to the expected behaviour that I have for this feature.
Steps To Reproduce
checkout and run npm link in guidemaker (or any npm package)
checkout and run npm link in guidemaker-default-template
go to a new node project with a package.json (ember app in my case)
run npm link guidemaker
run npm link guidemaker-default-template
Environment
OS: macOS 11.4
npm: '7.20.0',
node: '12.18.1',
Reacted by Alejandro Hernandez, Vincent St. Louis, razor, Brian Orora, Clayton Arends, Kaung Zin Hein, Johnathan and Stephen Schlueter
tl;dr - do npm link <pkg> --save if you want to save the fact that it's a link to your package.json and lockfile. Yes, it's weird, but it started in npm 5, and we haven't gotten to it yet. It's going to change in a future semver major release.
Reacted by Eric White, MigBash, Stephen Schlueter and Ilia Borsuk
Activity
isaacs commentedon Aug 17, 2021
Duplicate of this issue: #2372 (comment)
tl;dr - do
npm link <pkg> --saveif you want to save the fact that it's a link to your package.json and lockfile. Yes, it's weird, but it started in npm 5, and we haven't gotten to it yet. It's going to change in a future semver major release.