diff --git a/code/lib/cli/src/automigrate/fixes/mdx-gfm.ts b/code/lib/cli/src/automigrate/fixes/mdx-gfm.ts index 3cb8b345424d..89b381cb4ec1 100644 --- a/code/lib/cli/src/automigrate/fixes/mdx-gfm.ts +++ b/code/lib/cli/src/automigrate/fixes/mdx-gfm.ts @@ -61,10 +61,12 @@ export const mdxgfm: Fix = { async run({ packageManager, dryRun, mainConfigPath, skipInstall }) { if (!dryRun) { + const packageJson = packageManager.retrievePackageJson(); const versionToInstall = getStorybookVersionSpecifier(packageManager.retrievePackageJson()); - await packageManager.addDependencies({ installAsDevDependencies: true, skipInstall }, [ - `@storybook/addon-mdx-gfm@${versionToInstall}`, - ]); + await packageManager.addDependencies( + { installAsDevDependencies: true, skipInstall, packageJson }, + [`@storybook/addon-mdx-gfm@${versionToInstall}`] + ); await updateMainConfig({ mainConfigPath, dryRun }, async (main) => { const addonsToAdd = ['@storybook/addon-mdx-gfm'];