hydrogen: Starter template error

What is the location of your example repository?

No response

What version of Hydrogen are you using?

Hydrogen 2

What version of Remix are you using?

No response

Steps to Reproduce

npm init @shopify/hydrogen image

Expected Behavior

Normal initialization

Actual Behavior

Error in starter templates


About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 18 (8 by maintainers)

Most upvoted comments

That’s not worked

I’ve tried to use npm init @shopify/hydrogen@latest, but i’m still having the same issue.

@jarnodev Nice catch! That might be at least one of the problems. Regardless, we will try to get access to Windows environments before closing this issue again. We’ve been debugging this blindly so far 😅

I ran into a few issues using windows and the hydrogen-cli seems to attach a leading / to the distPath variable.

I tried both yarn create and npm create but not npm init. I wasn’t able to get the create script to work, however I copied the demo-store-ts template files to my local repository to get it up and running.

As a quick workaround to get the dev server to launch, I modified the local node_modules\@shopify\cli-hydrogen\dist\utils\virtual-routes.js file to assign the distPath as new URL("..", import.meta.url).pathname.substring(1); (adding the substring(1)).
This is not a solution to the situation, but may help guide contributors to a fix.

Seems like on line 15 the new URL(`file:///${relativeFilePath}`) is not accepted on Windows, removing a slash at file:/// so it becomes file:// fixes the problem on Windows, don’t know about other OS’es

Please try updating to @shopify/cli-hydrogen@^4.0.5, or directly with npm create @shopify/hydrogen@latest again 🤞

I’ve got more interesting error. in the first time I tried to create with npx and the second time with ‘npm crate…’ Screenshot 2023-02-14 165159 Screenshot 2023-02-14 165247

even don’t know what to say.

and again it does not download templates, added them to the templates folder from repo.

in the some previous version on Youtube I saw automatic templates downloading … image

and now I broke working version and can’t start new projects %)

Thanks everyone for reporting this. Trying to fix it in #495 . If anyone has some time and a Windows machine, please test these changes.

Hi thanks for your answer, I checked it, and now it works properly.

I copied templates to the “C:\Users\Ltuser\AppData\Local\npm-cache_npx\0e131c694ee80c91\node_modules@shopify\cli-hydrogen\dist\starter-templates\cli-hydrogen@4.0.3\templates” by hands from downloaded repository. After that I had a luck to create new app (thanks to the authors above) I had a problem to run it. I have duplicate disk letter after “npm run dev” [(image )]

Also tried to build with “create” and “init” the result is the same. platform: Windows 11, Node 18.14.0

Thank you for reporting this. This looks to be Windows specific. We are working on a fix.