N
Nuxt2w ago
kb

Deploying to Cloudflare - cant see /manifest.json

Ive got a static site that im trying to deploy, ive got ssr: false because were going on cloudflare, ive got my manifest.json in root public directory. it works locally. cf is built with npm run generate and told to serve from dist - but i get a 404 on the manifest. reasonably simple project:
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"fetch-swagger": "node scripts/fetch-swagger.js"
},
"dependencies": {
"@fullcalendar/core": "^6.1.17",
"@fullcalendar/daygrid": "^6.1.17",
"@fullcalendar/interaction": "^6.1.17",
"@fullcalendar/vue3": "^6.1.17",
"axios": "^1.9.0",
"nuxt": "^3.16.2",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@nuxtjs/google-fonts": "^3.2.0",
"@nuxtjs/tailwindcss": "^6.13.2"
}
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"fetch-swagger": "node scripts/fetch-swagger.js"
},
"dependencies": {
"@fullcalendar/core": "^6.1.17",
"@fullcalendar/daygrid": "^6.1.17",
"@fullcalendar/interaction": "^6.1.17",
"@fullcalendar/vue3": "^6.1.17",
"axios": "^1.9.0",
"nuxt": "^3.16.2",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@nuxtjs/google-fonts": "^3.2.0",
"@nuxtjs/tailwindcss": "^6.13.2"
}
I CAN see sw.js which is in the same location as manifest.json
5 Replies
kapa.ai
kapa.ai2w ago
Hi @kb. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It appears you are encountering a 404 for /manifest.json after deploying your Nuxt 3 static site to Cloudflare, even though the file is present in your public directory and works locally. This is a known issue that has affected several Nuxt 3 users, especially when using nuxt generate and serving from the generated output. Relevant Issue: - Since Nuxt 3.8.1, there was a bug where if you had a manifest.json in your public directory and referenced it in your nuxt.config.ts (e.g., via a <link rel="manifest" ...>), the generate process would incorrectly output a directory named manifest.json containing an index.html instead of copying the actual manifest.json file. This would result in a 404 or serving the wrong file type when requesting /manifest.json from your deployed site. Downgrading to 3.8.0 would avoid the issue, but it persisted in later versions until a fix was merged in Nitro (see details here). Workarounds and Solutions: - If you are on a version affected by this bug (e.g., 3.9.3 as reported), you may encounter this exact problem. The issue should be resolved in the latest versions of Nuxt and Nitro, specifically after this Nitro PR was merged. Upgrading both Nuxt and Nitro to their latest versions is recommended. - As a temporary workaround, some users found that removing the <link rel="manifest" ...> from nuxt.config.ts allowed the file to be copied correctly, but this is not ideal for PWA functionality. Summary of Steps: 1. Upgrade Nuxt and Nitro to the latest versions to ensure the bug is fixed. 2. Double-check your output directory after running nuxt generate to confirm that .output/public/manifest.json is a file, not a directory. 3. Ensure your deployment is serving from the correct output directory (for static hosting, it should be .output/public or dist as configured). 4. If you still encounter issues, verify that your deployment process is not overwriting or misrouting static files. References: - manifest.json becomes a folder with index.html instead of a JSON file since nuxt 3.8.1 If after upgrading you still see the issue, please provide your Nuxt and Nitro versions and the structure of your output directory after generation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@310160452221140996> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
kb
kbOP2w ago
@kapa.ai its not creating a folder
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Thank you for clarifying that Nuxt is not creating a folder for manifest.json—so the file is present as expected in your output. Based on the knowledge sources, if your manifest.json is present in the correct output directory (e.g., .output/public/manifest.json or dist/manifest.json), but you still get a 404 when accessing it on Cloudflare, the issue is likely related to how Cloudflare is serving or routing static files, not a Nuxt build bug. Key points from the sources: - The bug where manifest.json became a folder was specific to certain Nuxt/Nitro versions, but you confirmed this is not your case, so that bug does not apply here manifest.json folder issue. - If other static files (like sw.js) in the same directory are accessible, but manifest.json is not, this suggests a possible Cloudflare configuration or routing issue, not a Nuxt build problem. - There is no explicit information in the knowledge sources about Cloudflare blocking or mishandling manifest.json, nor about additional steps required for this file compared to others. What you can check: - Ensure Cloudflare is serving from the correct directory and that there are no custom rules or redirects affecting manifest.json. - Double-check the output directory after nuxt generate to confirm manifest.json is present alongside other static files. - If you reference the manifest in your HTML (e.g., via <link rel="manifest" href="/manifest.json">), make sure the path matches the deployed structure. Summary:
The knowledge sources do not provide a Nuxt-specific reason for manifest.json returning 404 if the file is present and other static files are accessible. The issue is likely with Cloudflare's configuration or routing, not with Nuxt itself. If you need further help, providing your Cloudflare configuration or deployment logs may help pinpoint the issue. If you have more details or logs, feel free to share them! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@310160452221140996> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?