nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

Only URLs with a scheme in: file, data are supported by the default ESM loade

Open edwinfadul opened this issue 1 year ago • 26 comments

Environment


  • Operating System: Windows_NT
  • Node Version: v18.12.1
  • Nuxt Version: 3.0.0
  • Nitro Version: 1.0.0
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: modules, typescript, build, css, vite, runtimeConfig
  • Runtime Modules: [email protected]
  • Build Modules: -

Reproduction

Versions

  • nuxt: v3.0.0
  • node: v18.12.1
  • windows: 10

By installing nuxt security and placing the dependency in nuxtjs config - modules: ['nuxt-security'] - https://nuxt.com/modules/security

Describe the bug

[worker reload] [worker init] Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

image

Additional context

It should be noted that I have tried several versions of nuxt and node - I have deleted node_modules - yesterday I upgraded nuxt and today again.

edwinfadul avatar Nov 17 '22 04:11 edwinfadul

me too...

edczjw avatar Nov 17 '22 08:11 edczjw

I want to point out that this is a general nuxt Windows-specific bug , I only have this on my Windows machine, and I have it with any module.

ennioVisco avatar Nov 20 '22 10:11 ennioVisco

Same with @nuxtjs/robots module. In development, the import for the alias #robots is written without the file:// import.

P4sca1 avatar Nov 21 '22 22:11 P4sca1

I have the same problem on nuxt3 3.0.0-rc.13 with @nuxtjs/robots 3.0.0 on a Windows machine

50l3r avatar Dec 02 '22 09:12 50l3r

@pi0 @danielroe guys, this is quite an important bug, it means that for the last month or so people are not able to run the development environment on Windows. It is really important for the adoption of nuxt 3 that someone takes care of it!

ennioVisco avatar Dec 02 '22 10:12 ennioVisco

This should be resolved in the edge channel, or in the next release.

If you're still experiencing it, please reply with a reproduction (as this error message can come from different sources) and I'll reopen.

danielroe avatar Dec 13 '22 14:12 danielroe

This should be resolved in the edge channel, or in the next release.

If you're still experiencing it, please reply with a reproduction (as this error message can come from different sources) and I'll reopen.

Unfortunately still an issue with:



I'll try to provide a sandbox reproduction in the upcoming days @danielroe!

Error log:

 ERROR  [worker reload] [worker init] Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' 

  at new NodeError (node:internal/errors:371:5)
  at defaultResolve (node:internal/modules/esm/resolve:1016:11)
  at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
  at link (node:internal/modules/esm/module_job:75:36)

ennioVisco avatar Dec 15 '22 08:12 ennioVisco

This is not resolved. I'm using edge channel.

teamboot88 avatar Dec 30 '22 19:12 teamboot88

If you're still experiencing it, please reply with a reproduction (as this error message can come from different sources) and I'll reopen.

danielroe avatar Dec 30 '22 19:12 danielroe

I found the part that caused the error. Occurred when adding a nuxt-proxy module and using the proxy option.

https://github.com/teamboot88/reproduction

teamboot88 avatar Dec 30 '22 19:12 teamboot88

I can confirm Clean Nuxt 3 Add nuxt-proxy with options.

{ "private": true, "scripts": { "build": "nuxt build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare" }, "devDependencies": { "nuxt": "3.0.0" }, "dependencies": { "nuxt-proxy": "^0.3.7" } }

` ERROR [worker reload] [worker init] Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'32:40

at new NodeError (node:internal/errors:393:5) at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1026:11) at defaultResolve (node:internal/modules/esm/resolve:1106:3) at nextResolve (node:internal/modules/esm/loader:163:28) at ESMLoader.resolve (node:internal/modules/esm/loader:841:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) at ModuleWrap. (node:internal/modules/esm/module_job:76:40) at link (node:internal/modules/esm/module_job:75:36) `

gitekDev avatar Jan 04 '23 22:01 gitekDev

It seems this is a general issue of several plugins, although I can tell that nuxt-icon, @vueuse/nuxt and intlify/nuxt3 work fine. I'll link the related issue that I found from other plugins: https://github.com/dargmuesli/nuxt-cookie-control/issues/14, https://github.com/nuxt-community/robots-module/issues/86.

ennioVisco avatar Jan 10 '23 18:01 ennioVisco

@ennioVisco did you found a solution to your problem?

damevin avatar Jan 12 '23 06:01 damevin

Same error with (https://github.com/dargmuesli/nuxt-cookie-control). Any solution?

filippodicostanzo avatar Jan 17 '23 12:01 filippodicostanzo

@ennioVisco did you found a solution to your problem?

I just removed the plugin :/

ennioVisco avatar Jan 17 '23 14:01 ennioVisco

Would you check whether the problem reproduces with the latest nuxt edge and nitropack edge?

danielroe avatar Jan 17 '23 16:01 danielroe

Would you check whether the problem reproduces with the latest nuxt edge and nitropack edge?

Unfortunately doesn't seem to work (same error) with @nuxtjs/robots with:


  • Operating System: Windows_NT
  • Node Version: v16.13.1
  • Nuxt Version: 3.0.1-rc.0-27898092.1e8da22
  • Nitro Version: 2.0.0-27898373.d89fa5f
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

ennioVisco avatar Jan 17 '23 19:01 ennioVisco

When they are going to release this solution, it is a blocker to install third-party modules. @danielroe

edwinfadul avatar Jan 17 '23 19:01 edwinfadul

https://github.com/wobsoriano/nuxt-remote-fn is also affected

But the issue appears to be resolved on the edge channel, at least for this module

  • Operating System: Windows 10
  • Node Version: v18.13.0
  • Nuxt Version: 3.0.1-rc.0-27898092.1e8da22
  • Nitro Version: 2.0.0-27898373.d89fa5f
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: -
  • Runtime Modules: [email protected]
  • Build Modules: -

kehwar avatar Jan 18 '23 03:01 kehwar

I've got a PR on @dargmuesli/nuxt-cookie-control which might not fix the root cause, I'm unsure. Just mentioning it in case it helps: https://github.com/dargmuesli/nuxt-cookie-control/pull/22/files

dargmuesli avatar Jan 25 '23 10:01 dargmuesli

I've got a PR on @dargmuesli/nuxt-cookie-control which might not fix the root cause, I'm unsure. Just mentioning it in case it helps: https://github.com/dargmuesli/nuxt-cookie-control/pull/22/files

Amazing catch @dargmuesli!

This clarifies that it's an issue of nuxt-kit's resolvePath: https://github.com/nuxt/nuxt/blob/1211f62d41b54592dd3bc0d9db62ef9ca0296177/packages/kit/src/resolve.ts#L29 which is in fact using normalize from unjs/pathe: https://github.com/unjs/pathe/blob/main/src/path.ts#L22.

I just pushed the issue upwards there :) https://github.com/unjs/pathe/issues/117

ennioVisco avatar Jan 25 '23 10:01 ennioVisco

me too with NUXT 3.1.0

DeivisFelipe avatar Jan 26 '23 14:01 DeivisFelipe

Hi, getting the same problem here.

Nuxi 3.1.1                                                                                                                                                                           18:50:45
                                                                                                                                                                                     18:50:46
RootDir: C:/Users/inmor/Documents/Proyectos/Naeko/dashboard                                                                                                                          18:50:46
Nuxt project info:                                                                                                                                                                   18:50:46

------------------------------
- Operating System: `Windows_NT`
- Node Version:     `v19.3.0`
- Nuxt Version:     `3.1.1`
- Nitro Version:    `2.1.0`
- Package Manager:  `[email protected]`
- Builder:          `vite`
- User Config:      `modules`, `css`, `htmlValidator`, `app`, `runtimeConfig`, `colorMode`, `security`, `i18n`
- Runtime Modules:  `@nuxtjs/[email protected]`, `@nuxtjs/[email protected]`, `@nuxtjs/[email protected]`, `@nuxtjs/[email protected]`, `@nuxtjs/[email protected]`, `@nuxt/[email protected]`, `[email protected]`, `[email protected]`, `@nuxtjs/[email protected]`, `[email protected]`
- Build Modules:    `-`
------------------------------

image

sawa-ko avatar Jan 27 '23 00:01 sawa-ko

I've got a PR on @dargmuesli/nuxt-cookie-control which might not fix the root cause, I'm unsure. Just mentioning it in case it helps: https://github.com/dargmuesli/nuxt-cookie-control/pull/22/files

Amazing catch @dargmuesli!

This clarifies that it's an issue of nuxt-kit's resolvePath:

https://github.com/nuxt/nuxt/blob/1211f62d41b54592dd3bc0d9db62ef9ca0296177/packages/kit/src/resolve.ts#L29

which is in fact using normalize from unjs/pathe: https://github.com/unjs/pathe/blob/main/src/path.ts#L22.

I just pushed the issue upwards there :) unjs/pathe#117

It works! Thnx!

videmann avatar Feb 11 '23 06:02 videmann

With which plugin it works? I'm still backtracking the changes to nuxt kit and pathe in order to find the exact cause of the issue, but I cannot find it yet :/

ennioVisco avatar Feb 11 '23 07:02 ennioVisco

I tried to run nuxt 3.2.0 with nuxt-cookie-control... nuxt starts, but when i append CookieControl component on page, it crashes.. after fix path does not contain slashes... exploring an error...

videmann avatar Feb 11 '23 07:02 videmann

Would you guys please try nuxt v3.2.3 (and @dargmuesli/nuxt-cookie-module v5.0.1) and report if fixes in those releases resolve this issue as well?

dargmuesli avatar Mar 01 '23 00:03 dargmuesli

Would you guys please try nuxt v3.2.3 (and @dargmuesli/nuxt-cookie-module v5.0.1) and report if fixes in those releases resolve this issue as well?

It doesn't work with nuxtjs/robots (I cannot tell about nuxt-cookie, but at some point I'll integrate it as well).

ennioVisco avatar Mar 01 '23 00:03 ennioVisco

nuxt 3.2.3 with nuxt-mail still have this problem

misway avatar Mar 01 '23 02:03 misway

nuxt 3.2.3 with nuxt-mail still have this problem

Same with nuxt 3.2.3 and @dargmuesli/nuxt-cookie-control

JulienChampagnol avatar Mar 01 '23 08:03 JulienChampagnol