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

Gracefully handle package.json not being found #167

Merged
merged 5 commits into from Oct 28, 2020
Merged

Gracefully handle package.json not being found #167

merged 5 commits into from Oct 28, 2020

Conversation

ryanrhee
Copy link
Contributor

@ryanrhee ryanrhee commented Oct 20, 2020

read-pkg-up's sync() can return undefined.
If that happens, we try to index into .packageJson, which fails.

Making the index operation null-safe makes execution continue on with pkg being set to an empty object, which is what seems to be the original intent.

`read-pkg-up`'s `sync()` can return undefined.
If that happens, we try to index into `.packageJson`, which fails.

Making the index operation null-safe makes execution continue on with `pkg` being set to an empty object, which is what seems to be the original intent.
@sindresorhus
Copy link
Owner

You cannot use this syntax. It's not supported in all the supported Node.js versions.

@sindresorhus sindresorhus changed the title handle read-pkg-up failure Gracefully handle package.json not being found Oct 28, 2020
@sindresorhus sindresorhus merged commit ef7ae5d into sindresorhus:master Oct 28, 2020
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.

None yet

2 participants