mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix: negate error on install without lockfile (#6851)
Change the error message to indicate the wanted lockfile is absent, not present. This now reflects the actual error. --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
6
.changeset/chilled-terms-matter.md
Normal file
6
.changeset/chilled-terms-matter.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/core": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Change the install error message when a lockfile is wanted but absent to indicate the wanted lockfile is absent, not present. This now reflects the actual error [#6851](https://github.com/pnpm/pnpm/pull/6851).
|
||||
@@ -416,7 +416,7 @@ Note that in CI environments, this setting is enabled by default.`,
|
||||
if (!satisfies) {
|
||||
if (!ctx.existsWantedLockfile) {
|
||||
throw new PnpmError('NO_LOCKFILE',
|
||||
`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is present`, {
|
||||
`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is absent`, {
|
||||
hint: 'Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ test(`frozen-lockfile: should fail if no ${WANTED_LOCKFILE} is present`, async (
|
||||
'is-positive': '^3.0.0',
|
||||
},
|
||||
}, await testDefaults({ frozenLockfile: true }))
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is present`)
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is absent`)
|
||||
})
|
||||
|
||||
test(`prefer-frozen-lockfile: should prefer headless installation when ${WANTED_LOCKFILE} satisfies package.json`, async () => {
|
||||
|
||||
Reference in New Issue
Block a user