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

[BUG] Aliases of NPM packages are broken when used in dependencies #4197

Open
2 tasks done
fabiospampinato opened this issue Dec 28, 2021 · 3 comments
Open
2 tasks done
Labels
Bug thing that needs fixing config:aliases Priority 2 secondary priority issue

Comments

@fabiospampinato
Copy link

fabiospampinato commented Dec 28, 2021

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Dependencies in the following package.json file are not resolved correctly:

{
  "dependencies": {
    "once": "^1.4.0",
    "pikchr-wasm": "^1.0.1"
  }
}

This is installed:

├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └── [email protected] deduped

Expected Behavior

Notice how the wrong once module got installed for pikchr-wasm, it's dependency tree should look like this:

[email protected]
└── once@npm:@fabiospampinato/[email protected]

I guess the problem is that NPM got confused since I'm using an alias for a module, and that alias is the name of another module that the parent package needs.

Steps To Reproduce

Run npm i on that package.json.

Environment

  • npm: 8.3.0
  • Node: 17.3.0
  • OS: macOS 12.1
  • platform: arm64
  • npm config:
; "user" config from /Users/fabio/.npmrc

//registry.npmjs.org/:_authToken = (protected) 
init.author.email = "[email protected]" 
init.author.name = "Fabio Spampinato" 
package-lock = false 
script-shell = "zsh" 

; node bin location = /Users/fabio/.nvm/versions/node/v16.13.0/bin/node
; cwd = /Users/fabio/Desktop/asd
; HOME = /Users/fabio
; Run `npm config ls -l` to show all defaults.
@fabiospampinato fabiospampinato added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Dec 28, 2021
@fabiospampinato
Copy link
Author

fabiospampinato commented Dec 28, 2021

I just checked that it reproduces on latest under Node v17 too.

@ruyadorno
Copy link
Contributor

hi @fabiospampinato thanks for reporting this issue, just to be sure, the problem here is that npm ls is reporting the wrong package name (not following the alias) ? Everything else works fine in the installation?

@ruyadorno ruyadorno added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Jan 27, 2022
@fabiospampinato
Copy link
Author

No, npm installed the wrong package. You can check manually what got installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing config:aliases Priority 2 secondary priority issue
Projects
None yet
Development

No branches or pull requests

3 participants