Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vite-node] [ERR_LOAD_URL] ..vue error in dev mode (Docker only) #20446

Closed
daniluk4000 opened this issue Apr 22, 2023 · 28 comments
Closed

[vite-node] [ERR_LOAD_URL] ..vue error in dev mode (Docker only) #20446

daniluk4000 opened this issue Apr 22, 2023 · 28 comments

Comments

@daniluk4000
Copy link
Contributor

daniluk4000 commented Apr 22, 2023

Environment


  • Operating System: Linux
  • Node Version: v18.15.0
  • Nuxt Version: 3.4.2
  • Nitro Version: 2.3.3
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/daniluk4000/nuxt-3.4.2-docker-error

Please read Readme.md in this repo before you launch it.

Describe the bug

The only thing I did - executed nuxi upgrade to upgrade from 3.4.1 to 3.4.2, then I've started to face this error when I launch project (dev mode only)

image

I've tried to clear .nuxt folders and do clean startup, but had no success.

Reproduction repo is simply "npx nuxi@latest init" with a bit of changes for Dockerization.

Additional context

I wasn't able to reproduce this error outside of Docker environment.

Workaround

Change WORKDIR from /app to any random folder, ex. /frontend

@outluch
Copy link

outluch commented Apr 22, 2023

What a coincidence. Just 3 hrs ago tried to run nuxt3 development in docker and see exact same error. Still fighting...

@outluch
Copy link

outluch commented Apr 22, 2023

Ok, I managed to run it in docker by downgrading nuxt to 4.3.1 version in package.json.
So, bug is somehow related to latest bump to Vite 4.3 I guess.. https://github.com/nuxt/nuxt/releases/tag/v3.4.2

@daniluk4000
Copy link
Contributor Author

@danielroe can you & team please take a look at this and include fix in v3.4.3 if possible 🙏

This is upgrade blocker for teams who use docker

@AwesomeAnders
Copy link

I'm also running a docker setup and been getting a bunch of these errors after upgrading nuxt. It happens seemingly spontaneous on page refreshes. Maybe it's related?

image

Copy link
Member

cc: @antfu

harusame0616 added a commit to harusame0616/nuxt-aws-apprunner that referenced this issue Apr 29, 2023
エラーが出るため暫定対策
nuxt/nuxt#20446
[vite-node] [ERR_LOAD_URL] ..vue error in dev mode
@tebaly
Copy link

tebaly commented May 1, 2023

  "devDependencies": {
    ...
    "nuxt": "~3.3.2"
  }

use --force option (ignore vite cache)

yarn dev --force

@daniluk4000
Copy link
Contributor Author

@antfu Can you please take a look at this? This is a blocker for updating Nuxt.

@antfu antfu self-assigned this May 2, 2023
@antfu
Copy link
Member

antfu commented May 2, 2023

I am not familiar with Docker, and I need sometime to set it up

@daniluk4000
Copy link
Contributor Author

I am not familiar with Docker, and I need sometime to set it up

Ah. Is there any way I can help with debugging? This error is super not informative.

@daniluk4000
Copy link
Contributor Author

daniluk4000 commented May 2, 2023

The bug is: on defaultTemplates resolve in generateApp it inserts export { default } from "/app/app.vue";, where /app is Docker workdir.

But when I try to import it, Vite fails, it works fine without Docker and breaks inside. File does exist in filesystem.

image

I don't think I can go much deeper, I think there is a bug in resolving somewhere inside...

@daniluk4000
Copy link
Contributor Author

daniluk4000 commented May 2, 2023

Well, I decided to go deep.

Found a workaround: change /app to any random folder (ex. /frontend) in Dockerfile WORKDIR e.t.c.

Something is going on with /app/app.vue path...

@daniluk4000
Copy link
Contributor Author

daniluk4000 commented May 2, 2023

I've spent hours on this and I give up (at least for today).

My conclusion: it looks so much like Vite 3.4.0 bug. I downgraded vite-node version and it worked just fine, also my other project on Nuxt 3.4.1 uses same vite-node version.

I have reviewed all Nuxt 3.4.2. diff and didn't find anything.

I have also downgraded Vite version to 4.2.2, removed some not compatible code and it worked just fine without any errors.

If I will be able to reproduce this in pure vite environment, I'll report an issue to them and close this. Would appreciate help with this since I dont't know the internals well...

@daniluk4000
Copy link
Contributor Author

Wasn't able to reproduce this in pure Vite without Nuxt.

image
image

Maybe Vite 4.3.2 somehow broke something how Nuxt uses Vite. I'll leave this issue to you guys as we have workaround for upgrading to Nuxt now.

@vwnd
Copy link

vwnd commented May 19, 2023

Well, I decided to go deep.

Found a workaround: change /app to any random folder (e.g. /frontend) in Dockerfile WORKDIR e.t.c.

Something is going on with /app/app.vue path...

Solved for me. Very weird.

@nrueckmann
Copy link

Still happening in
Nuxi 3.5.2
Nuxt 3.5.2
Nitro 2.4.1

@zejefferson
Copy link

zejefferson commented Jun 5, 2023

Same error for me in a node:18 docker container with a fresh install with Nuxt 3.5.2 and using /app as the WORKDIR.

Using any other folder than /app as the WORKDIR "solves" it.

@fredevery
Copy link

Same error for me in a node:18 docker container with a fresh install with Nuxt 3.5.2 and using /app as the WORKDIR.

Using any other folder than /app as the WORKDIR "solves" it.

How did you figure that out? Totally fixed my issue.

@zejefferson
Copy link

Same error for me in a node:18 docker container with a fresh install with Nuxt 3.5.2 and using /app as the WORKDIR.
Using any other folder than /app as the WORKDIR "solves" it.

How did you figure that out? Totally fixed my issue.

I didn't, daniluk4000 did and shared it earlier in the thread. :)

@daniluk4000
Copy link
Contributor Author

Same error for me in a node:18 docker container with a fresh install with Nuxt 3.5.2 and using /app as the WORKDIR.
Using any other folder than /app as the WORKDIR "solves" it.

How did you figure that out? Totally fixed my issue.

Well if you're curious... First I've tried to find problem in Nuxt, debugged it and found out the problem is somewhere inside "import" and Nuxt seems to do everything correctly. Then, I've tried to debug vite-node and figured out the problem is somewhere inside Vite.

During debug, I saw that /app/app.vue is being replaced to /app.vue somewhere inside Vite. I thought it can't be just coindidence and changed /app to /frontend. When it worked on both hello world and my real project, I've stopped debugging (except for pure Vite check) and posted workaround here.

Sadly, I don't have time & expertise to debug Vite with Nuxt configuration. My best guess is something in Nuxt's Vite configuration got broken after Vite 4.3.0 (probably on Vite side), but I couldn't go much far.

@MrCheater
Copy link

+1

1 similar comment
@makakken
Copy link

+1

@just-maik
Copy link
Sponsor

+1 using Docker on Kubernetes having the same issue. Moving from /app to /nuxt worked for me.

quintusl added a commit to scj2000/scj2000-web-v2 that referenced this issue Jun 30, 2023
mieze018 added a commit to mieze018/RailsAPI-Tutorial that referenced this issue Jul 14, 2023
@Sascha-Block
Copy link

Sascha-Block commented Aug 26, 2023

I'm having the same issue right now.

├── @invictus.codes/nuxt-vuetify@0.3.0
├── @nuxt/devtools@0.7.0
├── @types/node@18.16.19
├── nuxt@3.6.5
└── nuxt3@3.7.1-28216789.9013f88e

My sources are public: https://github.com/rock-the-prototype/nuxt-the-prototype/

The error occurred only after today's changes.

Does't this look like a problem that could indicate a collision between Vite and Vuetify? So it could be that there is an incompatibility or conflict between the versions of Vite, Vuetify, or Nuxt. It is possible that one of the dependencies is not resolved properly or that there is difficulty integrating the different build tools.

Sascha-Block referenced this issue in rock-the-prototype/nuxt-the-prototype Aug 26, 2023
@gnuion
Copy link

gnuion commented Aug 29, 2023

Well, I decided to go deep.

Found a workaround: change /app to any random folder (ex. /frontend) in Dockerfile WORKDIR e.t.c.

Something is going on with /app/app.vue path...

Thank you! Looks to be a nuxt bug. Finally running nuxt inside podman inside code-server inside kubernetes inside alpine os virtual machine inside windows 10

@danielroe
Copy link
Member

this will be resolved in vite v5.

@wrode
Copy link

wrode commented Jan 24, 2024

image

Currently getting this issue after running npx nuxi@latest init

@etherphis
Copy link

  "devDependencies": {
    ...
    "nuxt": "~3.3.2"
  }

use --force option (ignore vite cache)

yarn dev --force

I changed from ^3.10.2 to ~3.3.2

appreciate it that u gave me this nuxt version it fixed this issue for me.

@AleksandrCherednichenko-developer

@wrode The same thing is happening with my nuxt project, I have been trying to overcome this problem for the second day. I've seen comments that this is solved by upgrading the nuxt version to newer ones, but in my case it doesn't work. Please let us know if you find a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests