diff --git a/code/lib/cli/src/generators/baseGenerator.ts b/code/lib/cli/src/generators/baseGenerator.ts index 5a9f48b201d7..fd57208bdb03 100644 --- a/code/lib/cli/src/generators/baseGenerator.ts +++ b/code/lib/cli/src/generators/baseGenerator.ts @@ -273,10 +273,12 @@ export async function baseGenerator( if (isNewFolder) { await generateStorybookBabelConfigInCWD(); } - packageManager.addDependencies({ ...npmOptions, packageJson }, [ - ...versionedPackages, - ...babelDependencies, - ]); + + const depsToInstall = [...versionedPackages, ...babelDependencies]; + + if (depsToInstall.length > 0) { + packageManager.addDependencies({ ...npmOptions, packageJson }, depsToInstall); + } if (addScripts) { packageManager.addStorybookCommandInScripts({