nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.12k stars 622 forks source link

Error: The URL must be of scheme file when running nuxt prepare on Windows #2791

Open modigithub opened 1 month ago

modigithub commented 1 month ago

Environment

Reproduction

On windows:

  1. download https://github.com/nuxt-ui-pro/docs
  2. open terminal
  3. change dir to the downloaded folder
  4. use npm i

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

239 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-s390x
240 silly reify mark deleted [
240 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-s390x'
240 silly reify ]
241 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-riscv64
242 silly reify mark deleted [
242 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-riscv64'
242 silly reify ]
243 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-ppc64
244 silly reify mark deleted [
244 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-ppc64'
244 silly reify ]
245 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-mips64el
246 silly reify mark deleted [
246 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-mips64el'
246 silly reify ]
247 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-loong64
248 silly reify mark deleted [
248 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-loong64'
248 silly reify ]
249 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-ia32
250 silly reify mark deleted [
250 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-ia32'
250 silly reify ]
251 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-arm64
252 silly reify mark deleted [
252 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-arm64'
252 silly reify ]
253 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\linux-arm
254 silly reify mark deleted [
254 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\linux-arm'
254 silly reify ]
255 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\freebsd-x64
256 silly reify mark deleted [
256 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\freebsd-x64'
256 silly reify ]
257 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\freebsd-arm64
258 silly reify mark deleted [
258 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\freebsd-arm64'
258 silly reify ]
259 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\darwin-x64
260 silly reify mark deleted [
260 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\darwin-x64'
260 silly reify ]
261 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\darwin-arm64
262 silly reify mark deleted [
262 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\darwin-arm64'
262 silly reify ]
263 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\android-x64
264 silly reify mark deleted [
264 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\android-x64'
264 silly reify ]
265 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\android-arm64
266 silly reify mark deleted [
266 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\android-arm64'
266 silly reify ]
267 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\android-arm
268 silly reify mark deleted [
268 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\android-arm'
268 silly reify ]
269 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\vite-builder\node_modules\@esbuild\aix-ppc64
270 silly reify mark deleted [
270 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\vite-builder\\node_modules\\@esbuild\\aix-ppc64'
270 silly reify ]
271 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\win32-ia32
272 silly reify mark deleted [
272 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\win32-ia32'
272 silly reify ]
273 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\win32-arm64
274 silly reify mark deleted [
274 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\win32-arm64'
274 silly reify ]
275 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\sunos-x64
276 silly reify mark deleted [
276 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\sunos-x64'
276 silly reify ]
277 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\openbsd-x64
278 silly reify mark deleted [
278 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\openbsd-x64'
278 silly reify ]
279 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\netbsd-x64
280 silly reify mark deleted [
280 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\netbsd-x64'
280 silly reify ]
281 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-x64
282 silly reify mark deleted [
282 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-x64'
282 silly reify ]
283 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-s390x
284 silly reify mark deleted [
284 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-s390x'
284 silly reify ]
285 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-riscv64
286 silly reify mark deleted [
286 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-riscv64'
286 silly reify ]
287 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-ppc64
288 silly reify mark deleted [
288 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-ppc64'
288 silly reify ]
289 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-mips64el
290 silly reify mark deleted [
290 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-mips64el'
290 silly reify ]
291 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-loong64
292 silly reify mark deleted [
292 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-loong64'
292 silly reify ]
293 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-ia32
294 silly reify mark deleted [
294 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-ia32'
294 silly reify ]
295 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-arm64
296 silly reify mark deleted [
296 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-arm64'
296 silly reify ]
297 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\linux-arm
298 silly reify mark deleted [
298 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\linux-arm'
298 silly reify ]
299 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\freebsd-x64
300 silly reify mark deleted [
300 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\freebsd-x64'
300 silly reify ]
301 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\freebsd-arm64
302 silly reify mark deleted [
302 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\freebsd-arm64'
302 silly reify ]
303 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\darwin-x64
304 silly reify mark deleted [
304 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\darwin-x64'
304 silly reify ]
305 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\darwin-arm64
306 silly reify mark deleted [
306 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\darwin-arm64'
306 silly reify ]
307 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\android-x64
308 silly reify mark deleted [
308 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\android-x64'
308 silly reify ]
309 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\android-arm64
310 silly reify mark deleted [
310 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\android-arm64'
310 silly reify ]
311 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\android-arm
312 silly reify mark deleted [
312 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\android-arm'
312 silly reify ]
313 verbose reify failed optional dependency C:\source\modi-projects\ModiFax.Doc\node_modules\@nuxt\fonts\node_modules\@esbuild\aix-ppc64
314 silly reify mark deleted [
314 silly reify   'C:\\source\\modi-projects\\ModiFax.Doc\\node_modules\\@nuxt\\fonts\\node_modules\\@esbuild\\aix-ppc64'
314 silly reify ]
315 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 1303ms
316 silly audit report {}
317 verbose stack Error: command failed
317 verbose stack     at promiseSpawn (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:22:22)
317 verbose stack     at spawnWithShell (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:124:10)
317 verbose stack     at promiseSpawn (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:12:12)
317 verbose stack     at runScriptPkg (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script-pkg.js:77:13)
317 verbose stack     at runScript (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script.js:12:10)
317 verbose stack     at async Install.exec (C:\Program Files\nodejs\node_modules\npm\lib\commands\install.js:163:9)
317 verbose stack     at async Npm.exec (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:207:9)
317 verbose stack     at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli\entry.js:74:5)
318 error code 1
319 error path C:\source\modi-projects\ModiFax.Doc
320 error command failed
321 error command C:\Windows\system32\cmd.exe /d /s /c nuxt prepare
322 verbose cwd C:\source\modi-projects\ModiFax.Doc
323 verbose os Windows_NT 10.0.22631
324 verbose node v20.17.0
325 verbose npm  v10.8.2
326 verbose exit 1
327 verbose code 1
328 error A complete log of this run can be found in: C:\Users\ch\AppData\Local\npm-cache\_logs\2024-09-21T07_27_02_933Z-debug-0.log
modigithub commented 1 month ago

the problem is not the content. It is nuxt studio.