nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
993 stars 57 forks source link

throwIfUnsupportedURLScheme #316

Closed robert-hoffmann closed 1 month ago

robert-hoffmann commented 1 month ago

Describe the bug @nuxthub/core 0.7.27 is throwing:

ERROR  Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'e:'                              11:14:59 PM  

  at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:249:11)
  at defaultLoad (node:internal/modules/esm/load:130:3)
  at ModuleLoader.load (node:internal/modules/esm/loader:555:13)
  at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:56)
  at new ModuleJob (node:internal/modules/esm/module_job:71:27)
  at #createModuleJob (node:internal/modules/esm/loader:447:17)
  at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:259:34)
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:17)
  at async ModuleLoader.import (node:internal/modules/esm/loader:472:23)

Steps to reproduce This is hapening on windows 11 Node 20.18.0 Pnpm 9.12.0

Expected behavior Reverted to 0.7.26

atinux commented 1 month ago

Sorry about this, could you please try with:

pnpm add https://pkg.pr.new/nuxt-hub/core/@nuxthub/core@317

Then run both the npx nuxi dev and npx nuxi build commands and confirm that this fixes it? 🙏

robert-hoffmann commented 1 month ago

Nah still breaks

actually fails on: npx nuxi prepare (this is probably where it creates some directories for local dev)

atinux commented 1 month ago

What about with:

pnpm add https://pkg.pr.new/nuxt-hub/core/@nuxthub/core@49f67b5
robert-hoffmann commented 1 month ago

Yeah, still failing, heres the full command log

PS E:\server\i-technology\nuxthub-nutripath> pnpm add https://pkg.pr.new/nuxt-hub/core/@nuxthub/core@49f67b5
 WARN  9 deprecated subdependencies found: are-we-there-yet@2.0.0, gauge@3.0.2, glob@7.2.3, glob@8.1.0, inflight@1.0.6, npmlog@5.0.1, rimraf@3.0.2, rollup-plugin-inject@3.0.2, sourcemap-codec@1.4.8
Packages: +1
+
Progress: resolved 1119, reused 990, downloaded 1, added 1, done

devDependencies:
- @nuxthub/core 0.7.26
+ @nuxthub/core 0.7.27 already in devDependencies, was not moved to dependencies.

Done in 12.2s
PS E:\server\i-technology\nuxthub-nutripath> pnpm install --force
 WARN  using --force I sure hope you know what you are doing
Lockfile is up to date, resolution step is skipped
Packages: +1118
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1118, reused 1118, downloaded 0, added 1118, done

> nuxt-app@ postinstall E:\server\i-technology\nuxthub-nutripath
> npx nuxi prepare

npm warn using --force Recommended protections disabled.
ℹ Using Tailwind CSS from ~/assets/css/tailwind.css                                                                                                       nuxt:tailwindcss 2:04:23 PM

[2:04:25 PM]  ERROR  Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'e:'

  at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:249:11)
  at defaultLoad (node:internal/modules/esm/load:130:3)
  at ModuleLoader.load (node:internal/modules/esm/loader:555:13)
  at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:56)
  at new ModuleJob (node:internal/modules/esm/module_job:71:27)
  at #createModuleJob (node:internal/modules/esm/loader:447:17)
  at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:259:34)
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:17)
  at async ModuleLoader.import (node:internal/modules/esm/loader:472:23)

PS. I removed tailwind, because you can see the error just after ..but has no impact (reverting to 0.7.26 has no errors)

robert-hoffmann commented 1 month ago

Any way to bump up verbosity on error ? like for throwIfUnsupportedURLScheme, so we can see what it was actually trying to load, or who was calling it ?

robert-hoffmann commented 1 month ago

I can confirm this on 2 different windows pc's (just tried at work)

atinux commented 1 month ago

Please let me now is https://github.com/nuxt-hub/core/releases/tag/v0.7.28 fixes it, I added a test suite for Windows and it works in CI

robert-hoffmann commented 1 month ago

It works, but you need to delete pnpm-lock.yaml, and node_modules

[12:46:46 PM] ERROR Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i again after removing both package-lock.json and node_modules directory.

I do get this warning (pnpm dev), but haven't looked if it has any impact:

[12:52:41 PM] WARN "file:///D:/MaserEngineering/github/nuxthub-nutripath/node_modules/.pnpm/@nuxthub+core@0.7.28_ioredis@5.4.1_magicast@0.3.5_rollup@4.24.0_vite@5.4.8_@types+node@22.7.5_terser@5.34.1_/node_modules/@nuxthub/core/dist/runtime/cache/driver.js" is imported by "virtual:#internal/nitro/virtual/storage", but could not be resolved – treating it as an external dependency.