App init package manager confusion

I have reproduced the issue on the latest CLI version.

Yes, I am on the latest version

I have searched existing posts and this report is not a duplicate.

Yes, this isn’t a duplicate

In which of these areas are you experiencing a problem?

App

Expected behavior

Using an npm-installed version of shopify cli:

  • Generate a new app via shopify app init
  • Generate a new extension via shopify app generate extension
  • Extension generates correctly

Actual behavior

Using an npm-installed version of shopify cli:

  • Generate a new app, this appears to work correctly
  • Generate a new extension, this fails with a variety of pnpm errors

Reproduction steps

Using an npm-installed version of shopify cli:

  • Generate a new app via shopify app init
  • Generate a new extension via shopify app generate extension

Eventually working through the pnpm errors which involved installing pnpm, approving certain packages, generally messing around, ultimately still failed with a missing command error to do with graphql types.

I tried again with the steps below and it seems to work as expected:
Using an npm-installed version of shopify cli:

  • Generate a new app via shopify app init
  • Delete the pnpm-workspace.yaml file that is in the new app and delete all node_modules
  • run npm i
  • Generate a new extension via shopify app generate extension
  • Extension is generated with no errors and everything works normally

Verbose output

n/a

Operating system

MacOS 26.5

CLI version

@shopify/cli/4.2.0 darwin-arm64 node-v24.0.1

Shell

zsh

Nodejs version

24.0.1

What language and version are you using in your application?

Javascript

I had the same experience. So grateful for your post. Hope Shopify devs will address this for others running into this problem.

Have you tried just fully switching to pnpm as your package manager?

In the past I had issues with yarn + Shopify CLI, and it seems like at Shopify pnpm is the de facto official choice, so they might miss some bugs/issues for npm or other managers.

Hey @Andrew_Barclay - thanks for flagging this, and for the detailed write-up.

Could you please run which shopify and share the output? If the path contains pnpm (something like ~/Library/pnpm/...), that’s likely the issue. When your Node toolchain is managed by pnpm, even an npm-installed CLI binary can land under a pnpm-owned path, and the detection keys off that location. If not, please let us know and we can look into this further.

Either way, you can set the package manager explicitly at init time:

shopify app init --package-manager npm

Which will build an npm app, so generate extension runs npm too and pnpm stays out of it — the up-front version of what you already did by hand (deleting pnpm-workspace.yaml and reinstalling lands you in the same place).

And if you do decide to go with pnpm, the package-approval step you hit is pnpm’s own default in recent versions (it blocks dependency build scripts until you allow them), so that prompt is expected rather than a bug on your end.

Hope this helps!

@Wes-Dev-Shopify Thanks for the suggestions. I’ve since switched to a global pnpm installed version of the CLI and things now seem to be working much smoother but I don’t recall ever using pnpm prior to this and don’t think it was installed, so doubt it was in the path.

Previously I had the CLI installed globally via npm and I use asdf to manage node versions so as I recall which shopify gave a path to an asdf shim.

I did run into some other if not related then certainly adjacent issues while I was still trying to use npm - when generating a new extension only app it would automatically come with an app home extension, which worked great via app dev right out of the box. But when trying to add that same extension to an older app (generated a few weeks ago, iirc using CLI ~v3.8.x at the time) I couldn’t get it to work. Trying to generate a fresh extension failed, and copying the extension folder from a fresh app init failed to build. I think these were both related to app home extensions still being in RC and somehow npm wasn’t picking up on the rc package correctly. I switched to pnpm globally, copied in the pnpm workspaces config, and then it worked perfectly.

So feels like the “just use pnpm” is the happy path here. Might be helpful to guide people in that direction or note in the docs if that is indeed the preferred path.

Thanks for the extra detail, @Andrew_Barclay really helpful.

On package manager detection: which shopify will show your asdf shim, which is expected. What actually drives the npm-vs-pnpm choice is what that shim resolves to, so could you run:

realpath "$(which shopify)" or readlink -f "$(which shopify)"

If it lands under .asdf/…/node_modules/@shopify/cli, the CLI should be treating you as npm. If the resolved path contains “pnpm”, that pins down the misdetection and we’ll dig in further.

One more thing worth checking, specifically for the extension commands: in recent CLI versions, commands you run inside an existing app (generate extension, app dev, and the graphql codegen step) pick the package manager by walking up from the app folder, and a pnpm-lock.yaml or pnpm-workspace.yaml in any parent directory (even your home folder) will make them use pnpm, regardless of how the CLI was installed. You can check from your app directory with:

d="$PWD"; while [ "$d" != "/" ]; do ls -d "$d"/pnpm-lock.yaml "$d"/pnpm-workspace.yaml 2>/dev/null; d=$(dirname "$d"); done

If a stray one turns up above your project, removing it would stop those commands flipping to pnpm. This walk doesn’t apply to shopify app init, which is why init and the extension commands can disagree.

The app-home extension trouble looks like a separate issue. App Home extensions are still in RC, so they expect newer @shopify/* versions than an app scaffolded a few weeks ago on ~3.8.x has pinned. Generating (or copying) the extension into that older app resolved against its existing lockfile and older deps, so it never pulled the RC packages, which is why it failed to build. The fix isn’t pnpm specifically, it’s getting that app’s dependencies current: update the CLI and refresh its @shopify/* deps / regenerate the lockfile. Switching to pnpm also did a clean reinstall, which is most likely what actually resolved it; npm with an up-to-date dependency tree gets you to the same place. (Copying extension folders between apps isn’t a supported path, so I’d lean on generate extension inside an updated app.)

Regarding “just use pnpm”: the CLI is designed to work with whichever supported package manager you prefer and npm is one of the supported options, so we’d rather not steer folks toward pnpm as the answer; the goal is that your manager of choice just works. If you want to stay on npm, shopify app init --package-manager npm makes that explicit up front.

If you can share that resolved path, the output of the parent-folder check above, and the exact errors from the older app (and its CLI version), we can confirm both threads. Thanks again!