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: Add better error message when lockfile is malformed #6997

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions workspaces/arborist/lib/arborist/load-virtual.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const mapWorkspaces = require('@npmcli/map-workspaces')

const { resolve } = require('path')
const assert = require('assert');

Check failure on line 5 in workspaces/arborist/lib/arborist/load-virtual.js

View workflow job for this annotation

GitHub Actions / Lint

Extra semicolon

const nameFromFolder = require('@npmcli/name-from-folder')
const consistentResolve = require('../consistent-resolve.js')
Expand Down Expand Up @@ -200,6 +201,9 @@
const targetPath = resolve(this.path, meta.resolved)
const targetLoc = relpath(this.path, targetPath)
const target = nodes.get(targetLoc)

assert(target, `Missing target node for "${targetLoc}", remove the entry in your lock file and try again.`);

Check failure on line 205 in workspaces/arborist/lib/arborist/load-virtual.js

View workflow job for this annotation

GitHub Actions / Lint

Extra semicolon

const link = this.#loadLink(location, targetLoc, target, meta)
nodes.set(location, link)
nodes.set(targetLoc, link.target)
Expand Down