mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 04:52:04 -04:00
fix: improve the error message when modules directory should be recreated (#7308)
This commit is contained in:
5
.changeset/gentle-flies-smash.md
Normal file
5
.changeset/gentle-flies-smash.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/get-context": patch
|
||||
---
|
||||
|
||||
Improve the error message when `node_modules` should be recreated.
|
||||
@@ -1094,7 +1094,7 @@ test('when using a different registry, add -g to the error report according to o
|
||||
err = _err
|
||||
}
|
||||
expect(err.code).toBe('ERR_PNPM_REGISTRIES_MISMATCH')
|
||||
expect(err.message).toContain('pnpm install -g')
|
||||
expect(err.hint).toContain('pnpm install -g')
|
||||
})
|
||||
|
||||
test('broken lockfile is fixed even if it seems like up to date at first. Unless frozenLockfile option is set to true', async () => {
|
||||
|
||||
@@ -291,7 +291,9 @@ async function validateModules (
|
||||
await purgeModulesDirsOfImporters(opts, projects)
|
||||
return { purged: true }
|
||||
}
|
||||
throw new PnpmError('REGISTRIES_MISMATCH', `This modules directory was created using the following registries configuration: ${JSON.stringify(modules.registries)}. The current configuration is ${JSON.stringify(opts.registries)}. To recreate the modules directory using the new settings, run "pnpm install${opts.global ? ' -g' : ''}".`)
|
||||
throw new PnpmError('REGISTRIES_MISMATCH', `This modules directory was created using the following registries configuration: ${JSON.stringify(modules.registries)}. The current configuration is ${JSON.stringify(opts.registries)}.`, {
|
||||
hint: `To recreate the modules directory using the new settings, run "pnpm install${opts.global ? ' -g' : ''}".`,
|
||||
})
|
||||
}
|
||||
if (purged && (rootProject == null)) {
|
||||
await purgeModulesDirsOfImporter(opts, {
|
||||
|
||||
Reference in New Issue
Block a user