hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

`init` command doesn't work with npx

Open gfscott opened this issue 11 months ago • 2 comments

We document the init command but npx shopify hydrogen init doesn't work outside of an existing Hydrogen project:

image

It would be helpful to be able to use npx directly in the project create flow, because then you could pass flags to init directly, without having to do the double-dash trick:

create npx
npm create @shopify/hydrogen@latest -- --quickstart npx shopify hydrogen init --quickstart

gfscott avatar Mar 15 '24 20:03 gfscott

Not sure if this has worked before. What was working was npx @shopify/cli-hydrogen init, which uses our cli plugin directly as an executable but we shouldn't probably use this directly.

@isaacroldan Do you think we can make npx shopify hydrogen init work and forward flags to npm create?

frandiox avatar Mar 18 '24 12:03 frandiox

That would work with the global CLI project like: shopify hydrogen init which internally calls @shopify/cli-hydrogen init

npx shopify hydrogen init will also work if you have the global CLI installed

isaacroldan avatar Mar 18 '24 12:03 isaacroldan