1

Hei, I am creating a website with Nuxt and netlify cms when I run npm run generate it gives the error :

√ Generated route "/about"                                                                            10:03:26  

 ERROR  Error generating route "undefined": This page could not be found                              10:03:26  

√ Generated route "/"  

Then in my /dist folder I have an undefined folder. I can't figure it out where it comes from...I have deleted the folder and generate again, and it creates the folder again. If I go to the folder undefined inside there is an index.html files with the title " This page could not be found"... Can someone share some light please? much appreaciated

Ricardo Moreira
  • 947
  • 1
  • 9
  • 20

1 Answers1

0

I know this is an pretty old issue, but I stumbled upon a similar issue when using a link to a statically generated admin interface in Nuxt:

<a href='/admin'>...</a>

Nuxt is using a Crawler that scans for relative links and matches them with your dynamic ones. Since admin is not a Nuxt page I use, it was throwing the same error. The solution is to either set the crawler false or exclude the relative link it should ignore. In your nuxt.config.js do:

generate: {
    // crawler: false, or:
    exclude: ['/admin']
}

I can imagine in your case, you were using a relative link on an <a> tag with some kind of computed variable, maybe <a :href='link'> where link was actually undefined, which would let the crawler search for a 'undefined' page under your pages folder, causing the error. Just for anyone that lands here and still doesn't have a solution!

Nicolas Durant
  • 360
  • 2
  • 10