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

Fixes npm/cli#2800: npm outdated fails to parse aliases #34

Closed
wants to merge 1 commit into from
Closed

Fixes npm/cli#2800: npm outdated fails to parse aliases #34

wants to merge 1 commit into from

Conversation

IceCreamYou
Copy link

Currently, with a package.json like this:

{
  "name": "test-outdated-alias",
  "version": "1.0.0",
  "dependencies": {
    "foo": "npm:abbrev@^1.1.1"
  }
}

Running npm outdated produces an error because npm-pick-manifest throws an error when it sees the alias package type:

test-outdated-alias$ npm outdated --verbose
// snipped for brevity...
npm verb stack Error: Only tag, version, and range are supported
npm verb stack     at pickManifest (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:93:11)
npm verb stack     at module.exports (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:187:16)
npm verb stack     at Outdated.getOutdatedInfo (/usr/local/lib/node_modules/npm/lib/commands/outdated.js:229:22)
npm verb stack     at async Promise.all (index 5)
npm verb stack     at async Outdated.exec (/usr/local/lib/node_modules/npm/lib/commands/outdated.js:72:5)
npm verb stack     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:66:5)

So this PR changes npm-pick-manifest so that when it sees a package of type alias, it looks at its subSpec instead, basically ignoring the alias.

References

This fixes npm/cli#2800. I do not know if there is other code that relies on npm-pick-manifest failing on aliases, but I doubt it.

@IceCreamYou
Copy link
Author

@ruyadorno do you think you could give this a look? 🙏 Not sure if there's an active maintainer of this project but I see you made changes somewhat recently.

@IceCreamYou
Copy link
Author

@isaacs maybe you could take a look? (Hello 👋 to another Isaac S!)

@ruyadorno
Copy link

hi @IceCreamYou thank you for your contribution, unfortunately this won't quite work as expected. I tried the patch on my local environment and it only bypasses the error but still won't work 😞 it looks to me that the outdated command will still need a bit more custom logic in order to properly follow and display the aliased packages.

@ruyadorno ruyadorno closed this Feb 3, 2022
@ruyadorno
Copy link

Thanks to your PR I was pushed in a good direction and found what appears to be a complete solution to that problem, ref: npm/cli#4365 😄 thanks again for the help!

@IceCreamYou IceCreamYou deleted the patch-1 branch February 3, 2022 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] npm outdated fails to parse aliases
2 participants