Nuxt 3 and CloudFlare Pages - Failed: build output directory contains links to files that can't be accessed
By David Nahodyl | 2/3/2023

We recently ran into a new issue with deploying our Nuxt 3 app on CloudFlare Pages. All of our builds, including previously successful builds, started getting a new error message:
Failed: build output directory contains links to files that can't be accessed
The generate process would run successfully, but we'd get this error at the very end.
The cause of this appears to be an issue with a linked directory in the default Nuxt configuration in CloudFlare pages. If you follow the setup instructions for Nuxt or go with the default build configuration, CloudFlare will attempt to copy the /dist
directory as the source of your static site.
The /dist
folder is actually an alias of /.output/public
, which is the true location of your statically generated content. For whatever reason, this alias is not created in the build process or CloudFlare Pages' deploy process can't handle the alias correctly.
The solution to this is to update your build configuration to use the /.output/public
directory directly.
To change this, go to your Pages project, then to the settings tab. From there, go to Builds & deployments and update the "Build output directory option" to be /.output/public
.
Re-run your deploy and you should be all set!
Related Articles
Building our Jamstack site with Laravel, Statamic, and Nuxt
We’ve recently launched a new version of the Gearbox site, and the tech stack behind this is pretty fun! We’ve built our site using Jamstack methodologies to be able to deliver the highest performance for our visitors.
How Custom Software Can Solve Specialty Contractors' Unique Challenges
We've all been there - trying to make do with something that's just not quite right for us. Our construction clients feel the same way about off-the-shelf solutions that don't cater to their unique needs as specialty contractors. There's no need to scrap everything and start from scratch. Instead, consider a custom solution to fill in the gaps and optimize your business management.