mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-06 23:19:19 -04:00
@@ -79,11 +79,15 @@ function reportUnexpectedStore (err: Error, msg: object) {
|
||||
return stripIndent`
|
||||
${formatErrorSummary(err.message)}
|
||||
|
||||
expected: ${highlight(msg['expectedStorePath'])}
|
||||
actual: ${highlight(msg['actualStorePath'])}
|
||||
The dependencies at "${msg['modulesDir']}" are currently linked from the store at "${msg['expectedStorePath']}".
|
||||
|
||||
If you want to use the new store, run the same command with the ${highlight('--force')} parameter.
|
||||
`
|
||||
pnpm now wants to use the store at "${msg['actualStorePath']}" to link dependencies.
|
||||
|
||||
If you want to use the new store location, reinstall your dependencies with "pnpm install --force".
|
||||
|
||||
You may change the global store location by running "pnpm config set store <location>".
|
||||
(This error may happen if the node_modules was installed with a different major version of pnpm)
|
||||
`
|
||||
}
|
||||
|
||||
function reportStoreBreakingChange (msg: object) {
|
||||
|
||||
@@ -3,14 +3,17 @@ import { PnpmError } from '../../errorTypes'
|
||||
export default class UnexpectedStoreError extends PnpmError {
|
||||
public expectedStorePath: string
|
||||
public actualStorePath: string
|
||||
public modulesDir: string
|
||||
constructor (
|
||||
opts: {
|
||||
expectedStorePath: string,
|
||||
actualStorePath: string,
|
||||
modulesDir: string,
|
||||
},
|
||||
) {
|
||||
super('ERR_PNPM_UNEXPECTED_STORE', 'Unexpected store used for installation')
|
||||
super('ERR_PNPM_UNEXPECTED_STORE', 'Unexpected store location')
|
||||
this.expectedStorePath = opts.expectedStorePath
|
||||
this.actualStorePath = opts.actualStorePath
|
||||
this.modulesDir = opts.modulesDir
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export default function checkCompatibility (
|
||||
modules: Modules,
|
||||
opts: {
|
||||
storePath: string,
|
||||
modulesPath: string,
|
||||
modulesDir: string,
|
||||
},
|
||||
) {
|
||||
// Important: comparing paths with path.relative()
|
||||
@@ -19,11 +19,12 @@ export default function checkCompatibility (
|
||||
throw new UnexpectedStoreError({
|
||||
actualStorePath: opts.storePath,
|
||||
expectedStorePath: modules.store,
|
||||
modulesDir: opts.modulesDir,
|
||||
})
|
||||
}
|
||||
if (!modules.layoutVersion || modules.layoutVersion !== LAYOUT_VERSION) {
|
||||
throw new ModulesBreakingChangeError({
|
||||
modulesPath: opts.modulesPath,
|
||||
modulesPath: opts.modulesDir,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ async function validateNodeModules (
|
||||
+ ' You must remove that option, or else add the --force option to recreate the "node_modules" folder.',
|
||||
)
|
||||
}
|
||||
checkCompatibility(modules, { storePath: opts.store, modulesPath: importer.modulesDir })
|
||||
checkCompatibility(modules, { storePath: opts.store, modulesDir: importer.modulesDir })
|
||||
if (opts.lockfileDirectory !== importer.prefix && opts.include && modules.included) {
|
||||
for (const depsField of DEPENDENCIES_FIELDS) {
|
||||
if (opts.include[depsField] !== modules.included[depsField]) {
|
||||
|
||||
Reference in New Issue
Block a user