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

Fix error on pkg.name[0] when name is empty #201

Closed
wants to merge 1 commit into from
Closed

Fix error on pkg.name[0] when name is empty #201

wants to merge 1 commit into from

Conversation

SteveVanOpstal
Copy link

TypeError: Cannot read property '0' of undefined
at rmStuff (C:\Program Files\nodejs\node_modules\npm\lib\unbuild.js:61:24)

Closes npm/npm#17858
Closes npm/npm#18042
Closes https://npm.community/t/issue-npm-dedupe-crash-with-typeerror-cannot-read-property-0-of-undefined/644/3

@SteveVanOpstal SteveVanOpstal requested a review from a team as a code owner June 18, 2019 06:43
@isaacs isaacs self-assigned this Jun 26, 2019
@isaacs
Copy link
Contributor

isaacs commented Jun 26, 2019

Good job finding the source of the problem! However, I think this actually has a deeper bug, since the folder might be @scope/foo even if pkg.name is missing or unscoped.

A fix with a test will be in the next release.

@isaacs isaacs added needs-discussion semver:patch semver patch level for changes labels Jun 26, 2019
isaacs added a commit that referenced this pull request Jun 28, 2019
Fix: npm/npm#17858
Fix: npm/npm#18042
Fix: https://npm.community/t/issue-npm-dedupe-crash-with-typeerror-cannot-read-property-0-of-undefined/644/3
Close: #201

This fixes a bug where a package folder might have a package.json which
is missing or lacks a name property.  It also properly detects the
scoped-ness of a package folder even if the package name is not scoped,
since one might install `express@npm:@scope/express` and end up in that
state.
isaacs added a commit that referenced this pull request Jun 28, 2019
Fix: npm/npm#17858
Fix: npm/npm#18042
Fix: https://npm.community/t/issue-npm-dedupe-crash-with-typeerror-cannot-read-property-0-of-undefined/644/3
Close: #201

This fixes a bug where a package folder might have a package.json which
is missing or lacks a name property.  It also properly detects the
scoped-ness of a package folder even if the package name is not scoped,
since one might install `express@npm:@scope/express` and end up in that
state.
isaacs added a commit that referenced this pull request Jun 29, 2019
Fix: npm/npm#17858
Fix: npm/npm#18042
Fix: https://npm.community/t/issue-npm-dedupe-crash-with-typeerror-cannot-read-property-0-of-undefined/644/3
Close: #201

This fixes a bug where a package folder might have a package.json which
is missing or lacks a name property.  It also properly detects the
scoped-ness of a package folder even if the package name is not scoped,
since one might install `express@npm:@scope/express` and end up in that
state.
isaacs added a commit that referenced this pull request Jun 29, 2019
Fix: npm/npm#17858
Fix: npm/npm#18042
Fix: https://npm.community/t/issue-npm-dedupe-crash-with-typeerror-cannot-read-property-0-of-undefined/644/3
Close: #201

This fixes a bug where a package folder might have a package.json which
is missing or lacks a name property.  It also properly detects the
scoped-ness of a package folder even if the package name is not scoped,
since one might install `express@npm:@scope/express` and end up in that
state.
isaacs added a commit that referenced this pull request Jun 29, 2019
Fix: npm/npm#17858
Fix: npm/npm#18042
Fix: https://npm.community/t/issue-npm-dedupe-crash-with-typeerror-cannot-read-property-0-of-undefined/644/3
Close: #201

This fixes a bug where a package folder might have a package.json which
is missing or lacks a name property.  It also properly detects the
scoped-ness of a package folder even if the package name is not scoped,
since one might install `express@npm:@scope/express` and end up in that
state.
isaacs added a commit that referenced this pull request Jun 29, 2019
Fix: npm/npm#17858
Fix: npm/npm#18042
Fix: https://npm.community/t/issue-npm-dedupe-crash-with-typeerror-cannot-read-property-0-of-undefined/644/3
Close: #201

This fixes a bug where a package folder might have a package.json which
is missing or lacks a name property.  It also properly detects the
scoped-ness of a package folder even if the package name is not scoped,
since one might install `express@npm:@scope/express` and end up in that
state.
@isaacs isaacs closed this in d9238af Jul 3, 2019
@SteveVanOpstal SteveVanOpstal deleted the patch-1 branch July 3, 2019 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch semver patch level for changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

npm ERR! Cannot read property '0' of undefined Cannot read property '0' of undefined
2 participants