-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(arborist): Add better error message when lockfile is malformed #8268
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
Conversation
aab72e9
to
cc0d28a
Compare
cc0d28a
to
83eb43c
Compare
83eb43c
to
285c2cc
Compare
const err = new Error( | ||
`Missing target in lock file: "${targetLoc}" is referenced by "${location}" but does not exist. | ||
To fix: | ||
1. rm package-lock.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a bit too explosive. A more graceful fix would be to just remove the reference location
from the package lock and then run npm i
which fixes the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, That was supposed to be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That comment was only about removing node modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't ever recommend people manually edit their package-lock file. The real fix would be for npm install
to fix the tree, but that's a much bigger lift.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough
Overrides #6997 with a more standard way of expressing errors in the cli and has a test for it.