question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

static asset 404s print `[nitro] Error while generating error response FetchError: 404`

See original GitHub issue

Environment

Nuxt CLI v3.0.0-rc.3 11:53:48 RootDir: /Users/sheilar.gonzalez/vitesse-nuxt3 11:53:51 Nuxt project info: 11:53:51


Nuxt project info: 12:49:50


  • Operating System: Darwin
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.3
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: meta, srcDir, modules, buildModules, css, publicRuntimeConfig, env, build, sentry, vite
  • Runtime Modules: @nuxtjs/sentry@6.0.0-beta.3
  • Build Modules: @pinia/nuxt@0.1.9, @vueuse/nuxt@8.4.2

Reproduction

package.json

{
  "private": true,
  "scripts": {
    "dev": "nuxi dev",
    "build": "nuxi build",
    "preview": "nuxi preview",
    "generate": "npx nuxt generate",
    "lint": "vue-cli-service lint",
    "check": "nuxi typecheck client/",
    "start": "node .output/server/index.mjs"
  },
  "dependencies": {
    "@nuxtjs/auth-next": "latest",
    "@nuxtjs/axios": "~5.13.6",
    "@nuxtjs/sanity": "^1.1.1",
    "@nuxtjs/sentry": "^6.0.0-beta.3",
    "@pinia/nuxt": "^0.1.8",
    "bootstrap": "^5.1.3",
    "core-js": "^3.21.1",
    "moment-timezone": "^0.5.34",
    "pinia": "^2.0.11",
    "qs": "^6.10.3",
    "typed.js": "^2.0.12",
    "vue-disqus": "^5.1.0",
    "vue-gtag": "^2.0.1",
    "vue-router": "^4.0.3"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.12.1",
    "@typescript-eslint/parser": "^5.12.1",
    "@vue/cli-plugin-babel": "~5.0.1",
    "@vue/cli-plugin-eslint": "~5.0.1",
    "@vue/cli-plugin-router": "~5.0.1",
    "@vue/cli-service": "~5.0.1",
    "@vue/eslint-config-typescript": "^10.0.0",
    "@vueuse/nuxt": "^8.1.1",
    "autoprefixer": "^10.4.2",
    "eslint": "^8.9.0",
    "eslint-config-prettier": "^8.4.0",
    "eslint-plugin-nuxt": "~3.2.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-vue": "^8.5.0",
    "nuxt": "3.0.0-rc.1",
    "postcss": "^8.4.6",
    "prettier": "^2.4.1",
    "sass": "^1.49.8",
    "sass-loader": "^12.6.0",
    "typescript": "~4.6.2",
    "vue-tsc": "~0.34.3"
  }
}

nuxt config


import { defineNuxtConfig } from 'nuxt'

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
    meta: {

        link: [
            {
                rel: "stylesheet",
                href: "https://cdn.bootcdn.net/ajax/libs/font-awesome/6.1.0/css/all.min.css"
            },
            {
                rel: "stylesheet",
                href: "https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css"
            },
            {
                rel: "stylesheet",
                href: "https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.8.1/font/bootstrap-icons.min.css"
            }
        ],
        script: [
            // {
            //     type: 'text/javascript',
            //     src: "https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.bundle.min.js"
            // }
        ]
    },
    srcDir: "client/",
    modules: [
        // "@nuxtjs/axios",
        // "@nuxtjs/auth-next"
        "@nuxtjs/sentry",
        // "@nuxtjs/sanity'"
    ],
    buildModules: [
        "@pinia/nuxt",
        '@vueuse/nuxt',
    ],
    css: ["@/assets/css/base.scss"],
    publicRuntimeConfig: {
        DISQUS_SHORTNAME: "",
        GOOGLE_ANALYSIS: process.env.GOOGLE_ANALYSIS
    },
    env: {
        HOST_URL: process.env.HOST_URL || 'http://127.0.0.1:5000',
    },
    build: {
        postcss: {
            postcssOptions: {
                plugins: {
                    autoprefixer: {},
                }
            }
        }
    },
    // axios: {
    // baseURL: process.env.API_URL || "http://localhost:8000/api"
    // },
    //
    // auth: {
    //
    // },
    // vueuse: {
    //     ssrHandlers: true,
    // },
    // sanity: {
    //     projectId: 'myProject'
    // },
    sentry: {
        dsn: ''
    },
    vite: {
        logLevel: "info"
    }
})

run npm build.


> build
> nuxi build

Nuxt CLI v3.0.0-rc.3                                                                                                                10:45:55
✔ Sentry reporting is enabled (client side: enabled, server side: enabled)                                              nuxt:sentry 10:45:59
vite v2.9.9 building for production...                                                                                              10:46:02
10:46:02 AM [vite] ✨ new dependencies optimized: ufo, pinia/dist/pinia.mjs, vue-disqus, vue-gtag                                   10:46:02
10:46:02 AM [vite] ✨ optimized dependencies changed. reloading                                                                     10:46:02
transforming (25) app.vueℹ Vite client warmed up in 1870ms                                                                                                   10:46:02
✓ 164 modules transformed.                                                                                                          10:46:04
../.nuxt/dist/client/manifest.json               4.62 KiB                                                                           10:46:04
../.nuxt/dist/client/404-9392f2b4.mjs            0.66 KiB / gzip: 0.43 KiB                                                          10:46:04
../.nuxt/dist/client/about-77de8eae.mjs          7.62 KiB / gzip: 1.99 KiB                                                          10:46:04
../.nuxt/dist/client/login-712d7e7b.mjs          2.34 KiB / gzip: 1.08 KiB                                                          10:46:04
../.nuxt/dist/client/register-25f056ac.mjs       3.37 KiB / gzip: 1.30 KiB                                                          10:46:04
../.nuxt/dist/client/restPassword-b31fe07d.mjs   1.51 KiB / gzip: 0.78 KiB                                                          10:46:04
../.nuxt/dist/client/contact-40a4575f.mjs        4.40 KiB / gzip: 1.35 KiB                                                          10:46:04
../.nuxt/dist/client/architecture-6f3afacd.mjs   0.17 KiB / gzip: 0.16 KiB                                                          10:46:04
../.nuxt/dist/client/devops-7de8583f.mjs         0.17 KiB / gzip: 0.16 KiB                                                          10:46:04
../.nuxt/dist/client/vpn-ee81118d.mjs            0.17 KiB / gzip: 0.16 KiB                                                          10:46:04
../.nuxt/dist/client/detail-e1e2a1d8.mjs         5.06 KiB / gzip: 1.07 KiB                                                          10:46:04
../.nuxt/dist/client/jobs-eeba6594.mjs           0.17 KiB / gzip: 0.16 KiB                                                          10:46:04
../.nuxt/dist/client/index-80b4b2c1.mjs          14.12 KiB / gzip: 2.82 KiB                                                         10:46:04
../.nuxt/dist/client/user-397fca42.mjs           8.42 KiB / gzip: 2.47 KiB                                                          10:46:04
../.nuxt/dist/client/payment-1422b033.mjs        12.80 KiB / gzip: 3.02 KiB                                                         10:46:04
../.nuxt/dist/client/privacy-94beed27.mjs        4.34 KiB / gzip: 1.85 KiB                                                          10:46:04
../.nuxt/dist/client/terms-0dbde4d5.mjs          5.89 KiB / gzip: 2.15 KiB                                                          10:46:04
../.nuxt/dist/client/auth-128b0ae8.mjs           1.87 KiB / gzip: 0.94 KiB                                                          10:46:04
../.nuxt/dist/client/default-4311ca38.mjs        9.25 KiB / gzip: 2.35 KiB                                                          10:46:04
../.nuxt/dist/client/default.e2a612cf.css        0.62 KiB / gzip: 0.29 KiB                                                          10:46:04
../.nuxt/dist/client/auth.51416dac.css           0.40 KiB / gzip: 0.25 KiB                                                          10:46:04
../.nuxt/dist/client/recruitment-242cb42b.mjs    13.68 KiB / gzip: 3.75 KiB                                                         10:46:04
../.nuxt/dist/client/entry.a4ff7230.css          15.29 KiB / gzip: 3.61 KiB                                                         10:46:04
../.nuxt/dist/client/entry-8f86bb9c.mjs          141.47 KiB / gzip: 52.09 KiB                                                       10:46:04
ℹ Client built in 3625ms                                                                                                            10:46:04
ℹ Building server...                                                                                                                10:46:04
vite v2.9.9 building SSR bundle for production...                                                                                   10:46:04

 WARN  @nuxtjs/sentry doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

✓ 181 modules transformed.                                                                                                          10:46:05
../.nuxt/dist/server/server.mjs   315.12 KiB                                                                                        10:46:05
✔ Server built in 1194ms                                                                                                            10:46:05
✔ Generated public .output/public                                                                                             nitro 10:46:05
start Building server...                                                                                                      nitro 10:46:05
start Writing server bundle...                                                                                                nitro 10:46:09
✔ Server built                                                                                                                nitro 10:46:10
  ├─ .output/server/package.json (696 B) (318 B gzip)
  ├─ .output/server/index.mjs.map (105 B) (100 B gzip)
  ├─ .output/server/index.mjs (398 B) (228 B gzip)
  ├─ .output/server/chunks/vue3.mjs.map (384 B) (257 B gzip)
  ├─ .output/server/chunks/vue3.mjs (317 B) (226 B gzip)
  ├─ .output/server/chunks/nitro/static.mjs.map (2.92 kB) (633 B gzip)
  ├─ .output/server/chunks/nitro/static.mjs (28.6 kB) (4.54 kB gzip)
  ├─ .output/server/chunks/nitro/node-server.mjs.map (15.5 kB) (2.86 kB gzip)
  ├─ .output/server/chunks/nitro/node-server.mjs (12.6 kB) (4.13 kB gzip)
  ├─ .output/server/chunks/index.mjs.map (1.81 MB) (84.2 kB gzip)
  ├─ .output/server/chunks/index.mjs (405 kB) (92.2 kB gzip)
  ├─ .output/server/chunks/handlers/renderer.mjs.map (30.1 kB) (4.84 kB gzip)
  ├─ .output/server/chunks/handlers/renderer.mjs (23.6 kB) (6.52 kB gzip)
  ├─ .output/server/chunks/app/server.mjs.map (328 kB) (42.5 kB gzip)
  ├─ .output/server/chunks/app/server.mjs (469 kB) (87.4 kB gzip)
  ├─ .output/server/chunks/app/client.manifest.mjs.map (3.98 kB) (635 B gzip)
  └─ .output/server/chunks/app/client.manifest.mjs (4.84 kB) (800 B gzip)
Σ Total size: 5.94 MB (984 kB gzip)
✔ You can preview this build using node .output/server/index.mjs 

Describe the bug

run node .output/server/index.mjs

errors

[nitro] Error while generating error response FetchError: 404  (/__nuxt_error?url=/_nuxt/__vite_ping&statusCode=404&statusMessage=Cannot+find+static+asset+/_nuxt/__vite_ping&message=Cannot+find+static+asset+/_nuxt/__vite_ping&description)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.errorhandler [as onError] (file:///Users/sheilar.gonzalez/WebstormProjects/global_cloud_nuxt3/.output/server/chunks/nitro/node-server.mjs:310:16)
    at async Server.nodeHandler (file:///Users/sheilar.gonzalez/WebstormProjects/global_cloud_nuxt3/.output/server/node_modules/h3/dist/index.mjs:370:9)

Additional context

refer issue : https://github.com/antfu/vitesse-nuxt3/issues/40

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:23 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
jurgelcommented, Jul 20, 2022

I got the same error. After some debugging, I found it happened because I run the dev server and then open the browser, I think the browser calling “__vite_ping” periodically. So when I run the production build “nuxt start”, the browser still calls “__vite_ping”, but because there is no such thing on the production, the server logs the error. If I refresh the browser, the error is gone.

2reactions
eMeRiKa13commented, Jun 24, 2022

Same problem for me. I tried to remove 404.vue, but I still have the same error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetch returning 404 error: "GET <urlthatIwasfetchinghere> 404 ...
From MDN's HTTP status code documentation: 404 Not Found The server can not find the requested resource. In the browser, this means the...
Read more >
How To Properly Serve 404 Errors on SPAs (with SEO in Mind)
First: Make sure you think about your static assets folder - that's your JavaScript, CSS, and images. That folder should just serve files,...
Read more >
The End of the Web: Mastering 404 Errors with Magnolia
In this article, I will reveal how to respond to 404 errors in single-site and multi-site scenarios. I will also show you how...
Read more >
How To Troubleshoot and Fix WordPress 404 Errors (Plus an ...
A 404 error is generated by your server when a requested URL is not ... to troubleshooting 404s is to figure out whether...
Read more >
404 Errors: How to Find and Fix Them
A 404 error means that the page can't be found. Usually, this happens when the URL or its content was deleted or moved....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found