Skip to content

Failed to parse URL: [cause]: URL is not a constructor #145

@ericktreichel

Description

@ericktreichel

Hi everyone,
I am facing an error sometimes when loading or realoading my application in development. Actually, I believe it happened in production a few times, but I didnt pay attention in the logs at that time, so I can't confirm.
I noted it happens more in development when I am restart my App and I already have some Tab open in my browser with some url that is not the root of the site/app (/). For instance, if restart my app and I have http://localhost:4000/somepage opened, it will be realoaded automaticaly when the app restart, and will trigger the error I mentioned.
I believe this error is related with the @element-plus/nuxt module, but I am not sure.

My machine/project:
Node v20.18.1
@element-plus/nuxt: 1.1.1
element-plus: 2.9.7
Nuxt: 3.16..1
Vue: 3.5.13
VS Code version: Code - Insiders 1.99.0-insider (dc289883be5d37d5d2b2f7d30926aa42a3123437, 2025-03-21T19:26:48.394Z)
OS version: Windows_NT x64 10.0.26120
Modes:
Remote OS version: Linux x64 6.13.8-WSL2-STABLE+

This is the error I get:
`[Vue Router warn]: uncaught error during route navigation:

ERROR [GET] "http://127.0.0.1:42457/__nuxt_vite_node__/module//node_modules/element-plus/es/index.mjs": Failed to parse URL from http://127.0.0.1:42457/__nuxt_vite_node__/module//node_modules/element-plus/es/index.mjs

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async $fetchRaw2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:270:14)
at async $fetch2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:316:15)
at async Object.fetchModule (node_modules/@nuxt/vite-builder/dist/runtime/vite-node.mjs:47:14)
at async ViteNodeRunner.directRequest (node_modules/vite-node/dist/client.mjs:277:46)
at async ViteNodeRunner.cachedRequest (node_modules/vite-node/dist/client.mjs:206:14)
at async ViteNodeRunner.dependencyRequest (node_modules/vite-node/dist/client.mjs:259:12)
at async components/AudioRecorder.vue:8:31
at async ViteNodeRunner.runModule (node_modules/vite-node/dist/client.mjs:401:5)
at async ViteNodeRunner.directRequest (node_modules/vite-node/dist/client.mjs:381:5)

[cause]: Failed to parse URL from http://127.0.0.1:42457/__nuxt_vite_node__/module//node_modules/element-plus/es/index.mjs

  at node:internal/deps/undici/undici:13392:13
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async $fetchRaw2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:258:26)

[cause]: URL is not a constructor

    at new Request (node:internal/deps/undici/undici:9474:25)
    at fetch (node:internal/deps/undici/undici:10203:25)
    at fetch (node:internal/deps/undici/undici:13390:10)
    at fetch (node:internal/bootstrap/web/exposed-window-or-worker:72:12)
    at node_modules/ofetch/dist/node.mjs:26:58
    at $fetchRaw2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:258:32)
    at onError (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:179:16)
    at $fetchRaw2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:270:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async $fetch2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:316:15)`

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions