Skip to content

ERROR: The URL must be of scheme file when using with @nuxt/icon on Windows #72

@tobiasdiez

Description

@tobiasdiez

On Windows (and only there), when @nuxt/icon is used the following error is thrown when running nuxt prepare:

 ERROR  The URL must be of scheme file                                                                                                                                                                                                               10:11:49  

  at fileURLToPath (node:internal/url:1499:11)
  at fileURLToPath (/D:/Programming/nuxt-storybook/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:1971:25)
  at pathToFileURL (/D:/Programming/nuxt-storybook/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:1974:26)
  at _resolve (/D:/Programming/nuxt-storybook/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2108:10)
  at resolveSync (/D:/Programming/nuxt-storybook/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2111:10)
  at resolvePathSync (/D:/Programming/nuxt-storybook/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2121:24)
  at useComponentMetaParser (/D:/Programming/nuxt-storybook/node_modules/.pnpm/nuxt-component-meta@0.8.2_magicast@0.3.5_rollup@4.21.0_webpack-sources@3.2.3/node_modules/nuxt-component-meta/dist/parser.mjs:45:22)
  at /D:/Programming/nuxt-storybook/node_modules/.pnpm/nuxt-component-meta@0.8.2_magicast@0.3.5_rollup@4.21.0_webpack-sources@3.2.3/node_modules/nuxt-component-meta/dist/module.mjs:184:16
  at async /D:/Programming/nuxt-storybook/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@22.5.5_encoding@0.1.13_eslint@9.11.0_jiti@1.21._wweoqk3ugykrtijmbhvnbu5cwi/node_modules/nuxt/dist/index.mjs:2385:7
  at async generateApp (/D:/Programming/nuxt-storybook/node_modules/.pnpm/nuxt@3.13.2_@parcel+watcher@2.4.1_@types+node@22.5.5_encoding@0.1.13_eslint@9.11.0_jiti@1.21._wweoqk3ugykrtijmbhvnbu5cwi/node_modules/nuxt/dist/index.mjs:5250:3)
  at async _applyPromised (/D:/Programming/nuxt-storybook/node_modules/.pnpm/perfect-debounce@1.0.0/node_modules/perfect-debounce/dist/index.mjs:54:10)

The error is triggered at https://github.com/nuxtlabs/nuxt-component-meta/blob/e892375250636016dceca99ee76502f47ead626b/src/parser.ts#L59 where filepath is

D:/Programming/nuxt-storybook/node_modules/.pnpm/@nuxt+icon@1.4.4_magicast@0.3.5_rollup@4.21.0_vite@5.4.7_@types+node@22.5.5_sass@1.77.7_terse_a3xy66mctyjhya3mtap5zijhji/node_modules/@nuxt/icon/dist/runtime/components/index  

which is not existing (the real file name is index.js). Components for other modules have the existing full path like node_modules/@nuxt/ui/dist/runtime/components/elements/Icon.vue, which works.

This was introduced somewhere in between 0.6 > 0.8, see nuxt-modules/storybook#775. Most likely in #69.

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