dword-design / nuxt-mail

Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
Other
247 stars 18 forks source link

On Windows with basic config get ESM loader error re absolute paths. #143

Closed dpmillerau closed 1 year ago

dpmillerau commented 1 year ago

ON Windows I get the following error using repor https://github.com/dpmillerau/test-nuxt-mail.git - a clean nuxt3 install

PS C:\Users\DavidMiller\WebstormProjects\test-nuxt-mail> npm run dev

dev nuxt dev

                                                                                                                                           17:19:43

Nuxi 3.0.0 17:19:43 Nuxt 3.0.0 with Nitro 1.0.0 17:19:43 17:19:45

Local: http://localhost:3000/ Network: http://172.30.208.1:3000/ Network: http://192.168.1.106:3000/

i Vite client warmed up in 2493ms 17:19:51 √ Nitro built in 1046 ms nitro 17:19:52

ERROR [worker reload] [worker init] Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

at new NodeError (node:internal/errors:400:5) at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1055:11) at defaultResolve (node:internal/modules/esm/resolve:1135:3) at nextResolve (node:internal/modules/esm/loader:163:28) 17:19:43
at ESMLoader.resolve (node:internal/modules/esm/loader:842:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) at ModuleWrap. (node:internal/modules/esm/module_job:77:40) at link (node:internal/modules/esm/module_job:76:36)

dword-design commented 1 year ago

@dpmillerau hm that weird I have automated tests also for Windows. Does it happen on startup already or later? Can you find out where this is thrown in nuxt-mail or which path he is trying to import? Which Node version do you use?

Skroderi commented 1 year ago

I got the same error, any solutions? Tested node versions: 18.13, 16.12.0, 16.13.1

dpmillerau commented 1 year ago

Here's my log - I'm on Win 11

PS C:\Users\DavidMiller\WebstormProjects\test-nuxt-mail> npm -v 9.1.2 PS C:\Users\DavidMiller\WebstormProjects\test-nuxt-mail> node -v v18.13.0

PS C:\Users\DavidMiller\WebstormProjects\test-nuxt-mail> npm run dev

dev nuxt dev 09:13:44
Nuxi 3.0.0 09:13:44
Nuxt 3.0.0 with Nitro 1.0.0 09:13:44 09:13:46 Local: http://localhost:3000/ Network: http://172.21.144.1:3000/ Network: http://192.168.1.106:3000/

i Vite client warmed up in 2686ms 09:13:53 √ Nitro built in 808 ms nitro 09:13:54 09:13:44
ERROR [worker reload] [worker init] Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' 09:13:54

at new NodeError (node:internal/errors:400:5) at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1055:11) at defaultResolve (node:internal/modules/esm/resolve:1135:3) at nextResolve (node:internal/modules/esm/loader:163:28) at ESMLoader.resolve (node:internal/modules/esm/loader:842:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) at ModuleWrap. (node:internal/modules/esm/module_job:77:40) at link (node:internal/modules/esm/module_job:76:36)

dword-design commented 1 year ago

Seems to be a known issue

Skyline96 commented 1 year ago

@dword-design this issue can be fixed from module side as done here https://github.com/dargmuesli/nuxt-cookie-control/commit/33cc7fa650d2c17c72b8a0d1a16108c0c4092946 by @dargmuesli

I already tried it with nuxt-mail and it works.

dpmillerau commented 1 year ago

Tried 3.1.23 and I still get the same issue.

Skyline96 commented 1 year ago

Tried 3.1.23 and I still get the same issue.

You can try to fix it by patching '~/node_modules/nuxt-mail/dist/index.js' something like https://github.com/Skyline96/nuxt-mail/commit/6042b2ae800b749626ad28bf59c6c4f8f09c0496

maxwellfrolov commented 1 year ago

It still doesn't work on Windows for Nuxt3: [worker reload] [worker init] Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' Patches don't help.