Problem
installNodeModules() in packages/cli-kit/src/public/node/node-package-manager.ts always runs <pm> install <packages>, but yarn and pnpm require add instead of install when adding specific packages with version specifiers.
This caused hydrogen upgrade to fail on yarn projects, and would similarly fail on pnpm.
Current behavior
let args = ['install']
if (options.args) {
args = args.concat(options.args)
}
await exec(options.packageManager, args, execOptions)
This produces commands like:
yarn install @shopify/hydrogen@2025.7.1 — fails (install has been replaced with add)
pnpm install @shopify/hydrogen@2025.7.1 — fails (pnpm install installs from lockfile, not specific packages)
Expected behavior
When specific packages are passed via args, the correct subcommand should be used per package manager:
| Package Manager |
Correct Subcommand |
| npm |
install |
| yarn |
add |
| pnpm |
add |
| bun |
install |
Workaround
Shopify/hydrogen#3462 bypassed installNodeModules() with a direct exec() call that maps the correct subcommand per package manager. Once this upstream fix lands, that workaround can be removed.
References
Problem
installNodeModules()inpackages/cli-kit/src/public/node/node-package-manager.tsalways runs<pm> install <packages>, but yarn and pnpm requireaddinstead ofinstallwhen adding specific packages with version specifiers.This caused
hydrogen upgradeto fail on yarn projects, and would similarly fail on pnpm.Current behavior
This produces commands like:
yarn install @shopify/hydrogen@2025.7.1— fails (installhas been replaced withadd)pnpm install @shopify/hydrogen@2025.7.1— fails (pnpm installinstalls from lockfile, not specific packages)Expected behavior
When specific packages are passed via
args, the correct subcommand should be used per package manager:installaddaddinstallWorkaround
Shopify/hydrogen#3462 bypassed
installNodeModules()with a directexec()call that maps the correct subcommand per package manager. Once this upstream fix lands, that workaround can be removed.References