diff --git a/packages/cli/src/services/__tests__/community-packages.service.test.ts b/packages/cli/src/services/__tests__/community-packages.service.test.ts index df4591cd08..7298e73a63 100644 --- a/packages/cli/src/services/__tests__/community-packages.service.test.ts +++ b/packages/cli/src/services/__tests__/community-packages.service.test.ts @@ -410,6 +410,12 @@ describe('CommunityPackagesService', () => { expect.any(Object), expect.any(Function), ); + expect(loadNodesAndCredentials.unloadPackage).toHaveBeenCalledWith( + installedPackage.packageName, + ); + expect(loadNodesAndCredentials.loadPackage).toHaveBeenCalledWith( + installedPackage.packageName, + ); }); test('should throw when not licensed', async () => { diff --git a/packages/cli/src/services/community-packages.service.ts b/packages/cli/src/services/community-packages.service.ts index 4906a6ef33..9f09d0c310 100644 --- a/packages/cli/src/services/community-packages.service.ts +++ b/packages/cli/src/services/community-packages.service.ts @@ -354,6 +354,7 @@ export class CommunityPackagesService { let loader: PackageDirectoryLoader; try { + await this.loadNodesAndCredentials.unloadPackage(packageName); loader = await this.loadNodesAndCredentials.loadPackage(packageName); } catch (error) { // Remove this package since loading it failed