nuxt: static asset 404s print `[nitro] Error while generating error response FetchError: 404`
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (5 by maintainers)
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.
Same problem for me. I tried to remove 404.vue, but I still have the same error
Had the same issue. Removed
404.vueand now running production server works fineI just updated the node version to v16.15.0 and updated the nuxt to the latest version. kindly the issue seems to be resolved.
same problems
Similar issue here. Only happens in production, but occurs at server start (yarn run build && yarn run nuxi start).
If I try to request that page (http://localhost:3000//__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&data) it’s complaining about directly, from a dev environment (same server), it says it cannot be found (404) and I see this in the console log:
Confirmed. I decided to customize the 404 page, added the /pages/404.vue file, which contains only the template and styles, and now I get this error in the production build. Nuxt rc.4 Node v16.13.2
Same issue on production build. If I add custom
pages/404.vuewith contentnpm cache clean --forcedoesn’t helpnuxt version 3.0.0-rc.3 node version v17.9.0 (same issue on v16.15.0 and 18)
Reproduction steps:
@danielroe, please reopen the issue
npm cache clean --force fix it.