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

Windows - ERR_UNSUPPORTED_ESM_URL_SCHEME #71

Open
Pecral opened this issue Oct 1, 2023 · 9 comments
Open

Windows - ERR_UNSUPPORTED_ESM_URL_SCHEME #71

Pecral opened this issue Oct 1, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@Pecral
Copy link

Pecral commented Oct 1, 2023

Problems

image

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: 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:'

Environment

  • On windows 10/11
  • Nodejs 18.17.1 or Nodejs 20.6.1

The problem was reproducible on two different windows 10/11 machines.

Do you have any ideas?

@Ingramz
Copy link

Ingramz commented Oct 2, 2023

I'm encountering this issue as well. Quick debugging led me to the following line

const { viteFinal: ViteFile } = await import(require.resolve(join('@storybook/vue3-vite', 'preset')))
where require.resolve returns full path to file, generally starting with C: on windows, which the import function does not like. Other usages of import(require.resolve(..)) fail in similar manner.

Is there any reason why await import('@storybook/vue3-vite/preset') can't just be used?

@chakAs3
Copy link
Contributor

chakAs3 commented Oct 3, 2023

@tobiasdiez i will do some tests on Windows, would please create a reproduction repo for me?

@chakAs3 chakAs3 self-assigned this Oct 3, 2023
@chakAs3 chakAs3 added the bug Something isn't working label Oct 3, 2023
@tobiasdiez
Copy link
Collaborator

Perfect, I think it should already occur in the demo (see issue description), but here is also a real world repo: JabRef/JabRefOnline#2244

@chakAs3
Copy link
Contributor

chakAs3 commented Oct 3, 2023

where require.resolve returns full path to file, generally starting with C: on windows, which the import function does not like. Other usages of import(require.resolve(..)) fail in similar manner.

you are completely right, this was some legacy code from storybook codebase, i did not pay attention to it since it is not breaking on Mac, but yeah should work fine, Thanks @Ingramz

@chakAs3
Copy link
Contributor

chakAs3 commented Oct 3, 2023

@tobiasdiez , @Ingramz would please test now, https://stackblitz.com/~/github.com/storybook-vue/storybook-nuxt-demo.
on Windows, if it is fine i will release new version

@Ingramz
Copy link

Ingramz commented Oct 3, 2023

0.1.6-alpha.5 didn't work, but 0.1.6-alpha.6 seems to be fine.

build-storybook finishes without errors and storybook starts up the development web server, but there's something else wrong that doesn't build or load the stories properly. But that's out of the scope of this specific issue, which seems to be solved now.

@tobiasdiez
Copy link
Collaborator

I can confirm this error is fixed. However, I now get issues of the following form suggesting that the resolution of the nuxtlink is not working (not sure if its windows-specific):

ode_modules@storybook-vue
untimecomponents
uxt-link" from "D:/Programming/JabRefOnline/node_modules/@nuxt/content/dist/runtime/components/ContentNavigation.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

@daviddomkar
Copy link

daviddomkar commented Feb 12, 2024

Hello. I am still encountering this issue with latest version on Windows. Is there any fix for it?

@daviddomkar
Copy link

From additional testing I can confirm that version 0.2.1 works. But 0.2.2 and newer throws this exact error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants