mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-31 13:32:18 -04:00
fix: better workspace range resolution error
This commit is contained in:
5
.changeset/few-tips-press.md
Normal file
5
.changeset/few-tips-press.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/npm-resolver": patch
|
||||
---
|
||||
|
||||
When resolution from workspace fails, print the path to the project that has the unsatisfied dependency.
|
||||
@@ -208,7 +208,7 @@ function tryResolveFromWorkspace (
|
||||
if (!resolvedFromLocal) {
|
||||
throw new PnpmError(
|
||||
'NO_MATCHING_VERSION_INSIDE_WORKSPACE',
|
||||
`No matching version found for ${wantedDependency.alias}@${pref} inside the workspace`
|
||||
`In ${path.relative(process.cwd(), opts.projectDir)}: No matching version found for ${wantedDependency.alias}@${pref} inside the workspace`
|
||||
)
|
||||
}
|
||||
return resolvedFromLocal
|
||||
|
||||
@@ -1495,10 +1495,11 @@ test('workspace protocol: resolution fails if there is no matching local package
|
||||
storeDir,
|
||||
})
|
||||
|
||||
const projectDir = '/home/istvan/src'
|
||||
let err!: Error
|
||||
try {
|
||||
await resolve({ alias: 'is-positive', pref: 'workspace:^3.0.0' }, {
|
||||
projectDir: '/home/istvan/src',
|
||||
projectDir,
|
||||
registry,
|
||||
workspacePackages: {},
|
||||
})
|
||||
@@ -1508,7 +1509,7 @@ test('workspace protocol: resolution fails if there is no matching local package
|
||||
|
||||
t.ok(err)
|
||||
t.equal(err['code'], 'ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE')
|
||||
t.equal(err.message, 'No matching version found for is-positive@^3.0.0 inside the workspace')
|
||||
t.equal(err.message, `In ${path.relative(process.cwd(), projectDir)}: No matching version found for is-positive@^3.0.0 inside the workspace`)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user