-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[BUG] Could not resolve dependency when using carrat ranges #6639
Comments
Upon further investigation, the problem seems to lie with requested = npa.resolve(child.name, requested || '*', fromPath(requestor, requestor.edgesOut.get(child.name))) on line 25 within |
Which causes |
Trying to fix this locally if I make the following diff diff --git a/workspaces/arborist/lib/dep-valid.js b/workspaces/arborist/lib/dep-valid.js
index 4afb5e47c..a223fb1b8 100644
--- a/workspaces/arborist/lib/dep-valid.js
+++ b/workspaces/arborist/lib/dep-valid.js
@@ -120,8 +120,11 @@ const linkValid = (child, requested, requestor) => {
return !isLink
}
- // directory must be a link to the specified folder
- return isLink && relative(child.realpath, requested.fetchSpec) === ''
+ if (isLink) {
+ return relative(child.realpath, requested.fetchSpec) === '';
+ }
+
+ return path.isAbsolute(requested.fetchSpec);
}
const tarballValid = (child, requested, requestor) => {
diff --git a/workspaces/arborist/lib/node.js b/workspaces/arborist/lib/node.js
index bdc021b7c..eb653ea9e 100644
--- a/workspaces/arborist/lib/node.js
+++ b/workspaces/arborist/lib/node.js
@@ -1112,7 +1112,7 @@ class Node {
// if they're links, they match if the targets match
if (this.isLink) {
- return node.isLink && this.target.matches(node.target)
+ return node.isLink && this.target?.matches(node.target)
}
// if they're two project root nodes, they're different if the paths differ
Then this error gets resolved and the packages end up in their expected places |
Though this produces some oddities, so certainly not a complete solution.
|
Actually upon more investigation I think the issue is more to do with aborist's I noticed this because I looked at the formatting of the resolve error and it was |
I think this has something to do with how the edge's get created, where the root entry in a monorepo (which does contain enough information to fix the |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Given a monorepo with using npm workspaces and the following layout
And if I run
npm i
due to needing to resolve conflicts in mypackage-lock.json
or when I need to create mypackage-lock.json
from scratch then I get the following error:Expected Behavior
Given that
6.10.2
is compatible with^6.7.0
this should install without any errors.Environment
The text was updated successfully, but these errors were encountered: