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

install: add support for package aliases #3

Merged
merged 2 commits into from
Feb 18, 2019
Merged

Conversation

zkat
Copy link
Contributor

@zkat zkat commented Jul 6, 2018

TODO

  • basic implementation
  • fix npm i printouts
  • fix npm ls display
  • fix npm outdated and npm update support
  • land https://github.com/iarna/lock-verify/pull/3
  • check that cipm works, too
  • fix failing tests
    • ignore-install-link.js
    • 404-parent.js
    • 00-verify-ls-ok.js
    • check-install-self.js
    • dedupe-scoped.js
    • do-not-remove-other-bins.js
    • gently-rm-linked-module.js
    • gently-rm-symlinked-global-dir.js
    • install-actions.js
    • install-at-sub-path-locally.js
    • install-contributors-count.js
    • install-into-likenamed-folder.js
    • install-report-just-installed.js
    • install-scoped-already-installed.js
    • legacy-ignore-nested-rm.js
    • legacy-test-package.js
    • link.js
    • ls-l-depth-0.js
    • ls-peer.js
    • ls.js
    • shared-linked.js
    • shrinkwrap-default-dev.js
    • spec-local-specifiers.js
    • symlink-cycle.js
    • test/network/legacy-bundled-git.js
    • uninstall-link-clean.js

@zkat zkat requested a review from a team as a code owner July 6, 2018 00:08
@zkat zkat added the semver:minor new backwards-compatible feature label Jul 18, 2018
@zkat zkat closed this Jul 25, 2018
@zkat zkat reopened this Jul 26, 2018
@zkat zkat closed this Jul 26, 2018
@zkat zkat reopened this Jul 26, 2018
@zkat zkat force-pushed the release-next branch 4 times, most recently from 512c1d5 to f8396dd Compare August 23, 2018 01:24
@zkat zkat force-pushed the zkat/aliases branch 2 times, most recently from 9327bb3 to 96634a4 Compare December 5, 2018 22:31
@zkat zkat force-pushed the release-next branch 5 times, most recently from db63b89 to b09bc8c Compare January 23, 2019 18:36
@zkat zkat force-pushed the zkat/aliases branch 2 times, most recently from dadbf35 to be8274e Compare January 31, 2019 00:18
@zkat zkat force-pushed the zkat/aliases branch 4 times, most recently from 48f6de2 to ea19669 Compare February 7, 2019 23:06
Copy link
Contributor

@aeschright aeschright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️‍♀️! Looks good!

@zkat zkat merged commit b7b54f2 into release-next Feb 18, 2019
@zkat zkat deleted the zkat/aliases branch February 18, 2019 23:02
@zkat zkat mentioned this pull request Feb 21, 2019
4 tasks
@hinell
Copy link

hinell commented Apr 9, 2019

Where we can find documentation on this?

@benmonro
Copy link

docs or even a comment here with an example would be nice, i'm curious what this feature is all about...

@chee
Copy link

chee commented Apr 12, 2019

hey, @hinell and @benmonro. you can read more about this feature in the RFC for package aliases

https://github.com/npm/rfcs/blob/latest/implemented/0001-package-aliases.md

@hinell
Copy link

hinell commented Apr 17, 2019

@chee Thanks for the link.

Looks like this feature doesn't work. When I attempt to use npm i package@npm:express I get error:

Unwrap
    at invalidTagName (E:\Programs\NodeJS\node_modules\npm\node_modules\npm-package-arg\npa.js:87:15)
    at fromRegistry (E:\Programs\NodeJS\node_modules\npm\node_modules\npm-package-arg\npa.js:290:13)
    at Function.resolve (E:\Programs\NodeJS\node_modules\npm\node_modules\npm-package-arg\npa.js:77:12)
    at doesChildVersionMatch (E:\Programs\NodeJS\node_modules\npm\lib\install\deps.js:75:25)
    at exports.earliestInstallable (E:\Programs\NodeJS\node_modules\npm\lib\install\deps.js:800:10)
    at addBundled (E:\Programs\NodeJS\node_modules\npm\lib\install\deps.js:653:20)
    at addBundled (E:\Programs\NodeJS\node_modules\npm\lib\fetch-package-metadata.js:90:78)
    at isInstallable (E:\Programs\NodeJS\node_modules\npm\lib\install\deps.js:652:5)
    at checkPlatform (E:\Programs\NodeJS\node_modules\npm\node_modules\npm-install-checks\index.js:53:10)
    at thenWarnEngineIssues (E:\Programs\NodeJS\node_modules\npm\lib\install\validate-args.js:52:5)
    at a (E:\Programs\NodeJS\node_modules\npm\node_modules\iferr\iferr.js:3:64)
    at checkEngine (E:\Programs\NodeJS\node_modules\npm\node_modules\npm-install-checks\index.js:24:10)
    at module.exports.isInstallable (E:\Programs\NodeJS\node_modules\npm\lib\install\validate-args.js:49:3)
    at resolveWithNewModule (E:\Programs\NodeJS\node_modules\npm\lib\install\deps.js:650:10)
    at E:\Programs\NodeJS\node_modules\npm\lib\install\deps.js:245:5
    at E:\Programs\NodeJS\node_modules\npm\node_modules\slide\lib\async-map.js:52:35

My platform is Windows 10 x64
npm: 6.7.0
node: v11.14.0

@ljharb
Copy link
Contributor

ljharb commented Apr 17, 2019

@hinell the feature is in v6.9 of npm, you have v6.7.

@hinell
Copy link

hinell commented Apr 25, 2019

@ljharb Oh thank you!

@mikkorantalainen
Copy link

Documentation at https://github.com/npm/rfcs/blob/latest/implemented/0001-package-aliases.md mentions that this implementation

will NOT address ... replacing packages in transitive dependencies that have different names (npm i underscore@npm:lodash will only make it so require('underscore') in your own project loads lodash instead. Your dependencies will receive their own (nested) version of the actual underscore package). This may be covered in the future by an explicit resolutions mechanism, and may be facilitated by this RFC, but is still not part of it.

Are the any current plans for allowing aliasing packages in the transitive dependencies? I have a more specific question about this at https://stackoverflow.com/q/64121161/334451

@GimmiSingh GimmiSingh mentioned this pull request May 24, 2021
1 task
xtyrrell added a commit to xtyrrell/ohm-calculator that referenced this pull request Nov 28, 2021
This fixes a broken `npm i` caused by node-sass, is notoriously flakey.

This requires npm v6.9.0 or greater.
See npm/cli#3
d3xter666 added a commit to SAP/ui5-project that referenced this pull request May 4, 2023
Resolves: SAP/ui5-tooling#809

When shimmed packages are defined as dependency aliases in the
package.json, they are being excluded from the bundlig as the packager
eventually finds the real package and its path and as it's not defined
in the shim, but its alias, it gets ignored.

We need to provide more robust discovery in order to handle those cases:
- npm/cli#3
-
https://github.com/npm/rfcs/blob/main/implemented/0001-package-aliases.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor new backwards-compatible feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants