I encountered an issue when running npm install and the nuxt prepare script in my Nuxt 3 project on Windows. The error occurs during the postinstall step, and it seems related to how URLs and file paths are handled in Windows. The error message indicates that a URL must be of the scheme file://, but Windows absolute paths (e.g., C:/) don't seem to be recognized correctly.
Steps to Reproduce:
Download the Nuxt 3 doc project (https://github.com/nuxt-ui-pro/docs) and navigate with the terminal to the folder.
Run npm install on a Windows machine.
The error appears during the postinstall step.
Expected Behavior:
The nuxt prepare script should complete successfully without errors.
Actual Behavior:
The installation process fails with the following error message:
ERROR The URL must be of scheme file
at fileURLToPath (node:internal/url:1463:11)
at fileURLToPath (/C:/source/modi-projects/ModiFax.Doc/node_modules/mlly/dist/index.mjs:1971:25)
at pathToFileURL (/C:/source/modi-projects/ModiFax.Doc/node_modules/mlly/dist/index.mjs:1974:26)
at _resolve (/C:/source/modi-projects/ModiFax.Doc/node_modules/mlly/dist/index.mjs:2108:10)
...
This issue seems to be Windows-specific, as it is related to how absolute paths are handled on Windows (e.g., C:/) as opposed to file:// URLs. The problem might be in how fileURLToPath and related utilities are used in Windows environments. This issue doesn't occur when running the same project on macOS or Linux.
Environment
Reproduction
On windows:
Describe the bug
I encountered an issue when running npm install and the nuxt prepare script in my Nuxt 3 project on Windows. The error occurs during the postinstall step, and it seems related to how URLs and file paths are handled in Windows. The error message indicates that a URL must be of the scheme file://, but Windows absolute paths (e.g., C:/) don't seem to be recognized correctly.
Steps to Reproduce:
Download the Nuxt 3 doc project (https://github.com/nuxt-ui-pro/docs) and navigate with the terminal to the folder. Run npm install on a Windows machine. The error appears during the postinstall step.
Expected Behavior: The nuxt prepare script should complete successfully without errors.
Actual Behavior: The installation process fails with the following error message:
ERROR The URL must be of scheme file
at fileURLToPath (node:internal/url:1463:11) at fileURLToPath (/C:/source/modi-projects/ModiFax.Doc/node_modules/mlly/dist/index.mjs:1971:25) at pathToFileURL (/C:/source/modi-projects/ModiFax.Doc/node_modules/mlly/dist/index.mjs:1974:26) at _resolve (/C:/source/modi-projects/ModiFax.Doc/node_modules/mlly/dist/index.mjs:2108:10) ...
Environment:
Operating System: Windows 11 Node Version: 20.17.0 NPM Version: 10.8.2 Nuxt Version: 3.13.2 Relevant Modules: @nuxt/content, nuxt-component-meta, mlly
Additional context
This issue seems to be Windows-specific, as it is related to how absolute paths are handled on Windows (e.g., C:/) as opposed to file:// URLs. The problem might be in how fileURLToPath and related utilities are used in Windows environments. This issue doesn't occur when running the same project on macOS or Linux.
Logs