2023-07-05 15:11:16 +02:00
|
|
|
---
|
|
|
|
title: Cannot output to /public
|
|
|
|
---
|
2019-10-06 13:44:03 +02:00
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
## Why This Error Occurred
|
2019-10-06 13:44:03 +02:00
|
|
|
|
|
|
|
Either you set `distDir` to `public` in your `next.config.js` or during `next export` you tried to export to the `public` directory.
|
|
|
|
|
2021-06-24 06:33:58 +02:00
|
|
|
This is not allowed because `public` is used by Next.js to serve static assets.
|
2019-10-06 13:44:03 +02:00
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
## Possible Ways to Fix It
|
2019-10-06 13:44:03 +02:00
|
|
|
|
|
|
|
Use a different `distDir` or export to a different folder.
|
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
## Useful Links
|
2019-10-06 13:44:03 +02:00
|
|
|
|
2023-07-05 15:11:16 +02:00
|
|
|
- [Static file serving docs](/docs/pages/building-your-application/optimizing/static-assets)
|