From 879436f3c4534303fe4cead740d7d039e5ce0113 Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Thu, 19 Oct 2023 15:14:52 +0300 Subject: [PATCH] fix(core): check nxjson cli exists before looking for keys (#19730) --- .../migrations/update-17-0-0/rm-default-collection-npm-scope.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nx/src/migrations/update-17-0-0/rm-default-collection-npm-scope.ts b/packages/nx/src/migrations/update-17-0-0/rm-default-collection-npm-scope.ts index 940ada93aab4f..b4dbfe8a8c628 100644 --- a/packages/nx/src/migrations/update-17-0-0/rm-default-collection-npm-scope.ts +++ b/packages/nx/src/migrations/update-17-0-0/rm-default-collection-npm-scope.ts @@ -15,7 +15,7 @@ export default async function update(tree: Tree) { delete nxJson.cli?.['defaultCollection']; - if (Object.keys(nxJson.cli).length < 1) { + if (nxJson?.cli && Object.keys(nxJson.cli).length < 1) { delete nxJson.cli; }