Skip to content

[BUG] Running npm link for 2 packages removes the link to the first package #3568

Closed

Description

@mansona

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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

  1. checkout and run npm link in guidemaker (or any npm package)
  2. checkout and run npm link in guidemaker-default-template
  3. go to a new node project with a package.json (ember app in my case)
  4. run npm link guidemaker
  5. run npm link guidemaker-default-template

Environment

OS: macOS 11.4
npm: '7.20.0',
node: '12.18.1',

Activity

  1. added
    Bug
    Needs Triage
    Release 7.x
    on Jul 22, 2021
  2. isaacs commented on Aug 17, 2021

    @isaacs
    Contributor

    Duplicate of this issue: #2372 (comment)

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageRelease 7.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions