fix: prevent crash when expanding directories.bin without filesystem path#164
Merged
owlstronaut merged 2 commits intonpm:mainfrom Nov 18, 2025
Merged
Conversation
…path Fixes npm/cli#8722 When normalizing a package manifest fetched from a registry (without a filesystem path), attempting to expand 'directories.bin' would crash with ERR_INVALID_ARG_TYPE because pkg.path is undefined. This adds a check to only expand directories.bin when pkg.path exists, preventing the crash while maintaining correct behavior for packages with a filesystem location. Affects users with custom/private registries that don't pre-calculate the 'bin' field from 'directories.bin' in their package manifests.
tubacoopa
approved these changes
Nov 17, 2025
Member
|
This will need a test |
Contributor
Author
Test is added, please take a look. |
owlstronaut
approved these changes
Nov 18, 2025
Contributor
owlstronaut
left a comment
There was a problem hiding this comment.
Pragmatic, thank you for the contribution
Merged
owlstronaut
pushed a commit
that referenced
this pull request
Nov 18, 2025
🤖 I have created a release *beep* *boop* --- ## [7.0.3](v7.0.2...v7.0.3) (2025-11-18) ### Bug Fixes * [`57952b8`](57952b8) [#164](#164) prevent crash when expanding directories.bin without filesystem path (#164) (@MaxBlack-dev, Max Black) ### Dependencies * [`ba5c736`](ba5c736) [#165](#165) bump glob from 11.1.0 to 12.0.0 (#165) (@dependabot[bot]) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes npm/cli#8722
When normalizing a package manifest fetched from a registry (without a filesystem path), attempting to expand 'directories.bin' would crash with ERR_INVALID_ARG_TYPE because pkg.path is undefined.
This adds a check to only expand directories.bin when pkg.path exists, preventing the crash while maintaining correct behavior for packages with a filesystem location.
Impact:
npmcommands can fail withERR_INVALID_ARG_TYPEwhen normalizing manifests including adirectories.binfield cli#8722Testing: