Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On │ │ Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' #2208

Closed
farhaanxxiv opened this issue Jun 6, 2024 · 18 comments

Comments

@farhaanxxiv
Copy link

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2024.4.3

What version of Remix are you using?

2.0.4

Steps to Reproduce

npm create @shopify/hydrogen@latest
javascript

cd {package-name} && npm run dev

Expected Behavior

It should run the remix app locally.

Actual Behavior

It's showing an error

╭─ error ─────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On │
│ Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' │
│ │
│ To investigate the issue, examine this stack trace: │
│ at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239) │
│ at defaultLoad (node:internal/modules/esm/load:120) │
│ at load (node:internal/modules/esm/loader:555) │
│ at moduleProvider (node:internal/modules/esm/loader:436) │
│ at ModuleJob (node:internal/modules/esm/module_job:76) │
│ at #createModuleJob (node:internal/modules/esm/loader:449) │
│ at getJobFromResolveResult (node:internal/modules/esm/loader:261) │
│ at getModuleJob (node:internal/modules/esm/loader:242) │
│ at import (node:internal/modules/esm/loader:474) │
│ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯

Error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// 
URLs. Received protocol 'c:'
Code: ERR_UNSUPPORTED_ESM_URL_SCHEME

image

@sbaleno
Copy link

sbaleno commented Jun 7, 2024

Also seeing this issue

@gautamsi
Copy link

gautamsi commented Jun 7, 2024

this broken for Windows preventing upgrade to lates release.

@Codie123
Copy link

Codie123 commented Jun 7, 2024

image

Getting the same issue while trying to run the hydrogen app

any update on solution

@shogo54
Copy link

shogo54 commented Jun 7, 2024

I'm getting the same error on a Windows device as well

@Zetxus
Copy link

Zetxus commented Jun 8, 2024

Can confirm this behavior on the latest version as well. Seems to be Windows specific.

For the time being I'm running this on WSL and the error isn't present, but the node performance there is quite bad so I'd like to be able to run this on Windows as well.

@farhankhangit
Copy link

Can someone help me resolve the same issue?

image

@taksuparth
Copy link

Use WSL

@farhankhangit
Copy link

farhankhangit commented Jun 9, 2024

Okay thank you, I've set up the WSL but now I'm getting the following error:

image

Node version: 20.2.0
NPM version: 10.8.1

@paul-phan
Copy link

I believe this is related to the pull request at #2087. Just try downgrading @shopify/cli-hydrogen to 8.0.4, and it work.

@frandiox, @isaacroldan can you guys take a look?

@swappaa
Copy link

swappaa commented Jun 13, 2024

I've encountered the same issue, even after downgrading to @shopify/cli-hydrogen 8.0.4.
Do you have any other solutions to fix the issue?

image

@paul-phan
Copy link

@swappaa I think you should run npm run dev instead of h2 dev

@swappaa
Copy link

swappaa commented Jun 13, 2024

Thank you so much, @paul-phan. The h2 dev is working. I just installed it using npm i @shopify/cli-hydrogen@8.0.4 instead of manually modifying the version of @shopify/cli-hydrogen in package.json.

image

@farhankhangit
Copy link

farhankhangit commented Jun 13, 2024

For me, it was the permission issue the following command did the trick (for those who are facing the same issue)

chmod -R [desired permissions] [target folder]

@frandiox
Copy link
Contributor

Can you try with "@shopify/cli-hydrogen": "8.1.1" and see if the dev command works on Windows?

@rafael-franca
Copy link

@frandiox I tried here and confirm that 8.1.1 solves the problem in Windows 11.

@farhankhangit
Copy link

@rafael-franca can you please write the steps here?

Thank you!

@shogo54
Copy link

shogo54 commented Jun 17, 2024

@farhankhangit
in package.json on line 20, you can change:

"@shopify/cli-hydrogen": "^8.1.1",

to

"@shopify/cli-hydrogen": "8.1.1",

then run npm install and npm run dev works just fine.

This fixed the problem for me on Windows 11 as well.

@frandiox
Copy link
Contributor

Thanks everyone for reporting and testing the fix. Closing this now ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests