nuxt: 404 error when created file in /pages and redirect new router(page), until restart the srerver

Environment


  • Operating System: Windows_NT
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-27496606.e43ba6e
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://v3.nuxtjs.org/guide/directory-structure/pages i follow the doc guaid about pages, run with local environment

update(17/04) :

  1. npx nuxi init nuxt3-app >> cd nuxt3-app >> npm install >> npm run dev

  2. create a home page in /pages index.vue <template><div>index page, go to <nuxt-link to='/test'>test</nuxt-link></div></template> when i created index.vue and change code in app.vue to this <template><NuxtPage/></template> the home page can auto render, it works

  3. but when i created test.vue in /pages <template><div>test</div></template> i click the test link in home page or i open the router link in broswer manually, the page render by 404 page

  4. i restart the server, then it works

Describe the bug

i created a new page file in /pages like /pages/test.vue then the /test response 404 error if i restart the server, then it works

Additional context

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

I was on windows,It works when I access it with the tag “NuxtLink”,but when open the router link in broswer manually, the page render by 404 page

I stumbled upon this issue multiple times during dev on Windows. A restart is required for routing to detect the new file. It may be specific to the OS.