@ -32,12 +32,6 @@ try {
if ( ! semver . satisfies ( version , defaultPackage . dependencies [ packageName ] ) ) {
const e = new TypeError ( ` Incorrect dependency version: ${ packageName } ` ) ;
e . code = 'DEP_WRONG_VERSION' ;
// delete the module from require cache so it doesn't break rest of the upgrade
// https://github.com/NodeBB/NodeBB/issues/11173
const resolvedModule = require . resolve ( packageName ) ;
if ( require . cache [ resolvedModule ] ) {
delete require . cache [ resolvedModule ] ;
}
throw e ;
}
} ;
@ -57,6 +51,16 @@ try {
packageInstall . preserveExtraneousPlugins ( ) ;
packageInstall . installAll ( ) ;
// delete the module from require cache so it doesn't break rest of the upgrade
// https://github.com/NodeBB/NodeBB/issues/11173
const packages = [ 'nconf' , 'async' , 'commander' , 'chalk' , 'lodash' , 'lru-cache' ] ;
packages . forEach ( ( packageName ) => {
const resolvedModule = require . resolve ( packageName ) ;
if ( require . cache [ resolvedModule ] ) {
delete require . cache [ resolvedModule ] ;
}
} ) ;
const chalk = require ( 'chalk' ) ;
console . log ( ` ${ chalk . green ( 'OK' ) } \n ` ) ;
} else {