Nuxt ошибка 500

Reproduction: https://stackblitz.com/edit/nuxt-starter-ykdhnn?file=nuxt.config.ts (hacky, see notes).

I started running into this issue quite a bit, I believe it’s related to Nitro v2 and did some digging today.

For me, what I’ve found is that this occurs when your workspace directory is being transpiled.

I have a replication with my nuxt-og-image repo: https://github.com/harlan-zw/nuxt-og-image/tree/temp/bugged-playground (pnpm i && pnpm run dev)

My setup is a playground directory as a subfolder of a module. The playground links the module using a link in package.json

export default defineNuxtConfig({
  modules: [
    'nuxt-og-image',
  ],
})
{
  "dependencies": {
    "nuxt-og-image": "link:../"
  }
}

With my setup it seems like a deeper issue with the node module resolution, pointing to the directory with the package.json instead of the /dist folder, leading it to inline vue again?

The issue was pretty easy to solve in this case, by swapping to a directory path instead of relying on the node module resolving. Don’t think it helps OP in this case.

export default defineNuxtConfig({
  modules: [
    resolve(__dirname, '../src/module'),
  ],
})

I tried to replication this in StackBlitz without much success using a similar setup as the above. I had to just manually point to the workspace dir to be transpiled and I could replicate it, see reproduction.

So in summary, I believe this is a Nitro issue with the inlining of deps, possibly module resolution issue (possibly with symlinks?). Related code would be this function https://github.com/unjs/nitro/blob/main/src/rollup/plugins/externals.ts#LL22C19-L22C19

@pi0 might have some ideas

I was working on a Nuxt.js project and everything was working perfectly, then suddenly the npm run dev failed. I tried to run it again and I am constantly getting this error:

 FATAL  Request failed with status code 500                                                                                          17:43:55

  at createError (node_modules/axios/lib/core/createError.js:16:15)
  at settle (node_modules/axios/lib/core/settle.js:18:12)
  at IncomingMessage.handleStreamEnd (node_modules/axios/lib/adapters/http.js:201:11)
  at IncomingMessage.emit (events.js:194:15)
  at IncomingMessage.EventEmitter.emit (domain.js:441:20)
  at endReadableNT (_stream_readable.js:1125:12)
  at process._tickCallback (internal/process/next_tick.js:63:19)


   ╭────────────────────────────────────────────────╮
   │                                                │
   │   ✖ Nuxt Fatal Error                           │
   │                                                │
   │   Error: Request failed with status code 500   │
   │                                                │
   ╰────────────────────────────────────────────────╯

npm ERR! code ELIFECYCLE
npm ERR! errno 1

I tried some typical solutions like removing the node_modules and .nuxt directories and installing the dependencies again, and went even further and re-installed nodejs but non of them worked. It is really strange since it happened suddenly while I wasn’t actually changing anything on the code, however I even recovered the latest working version of the app just to be sure, but that didn’t help either. Whatever is it, is not related to the project codes since the same code was working before without any error.

asked May 24, 2019 at 16:02

Torgheh's user avatar

3

I found the solution myself and I share it so no one else has to spend half a day figuring what is wrong.

Solution

A failed axios request inside the nuxt.config.js has caused this problem. So find the reason why the axios request throws the error, which is most probably because of a change in the api you are trying to call.

answered May 24, 2019 at 22:28

Torgheh's user avatar

TorghehTorgheh

7568 silver badges18 bronze badges

1

Подскажите пожалуйста, есть проект работающий на nuxt и все данные получает с бэкенда api laravel,
все крутится в докере на сервере

когда заходишь на страницу на прямую то выводит ошибку 500 (Код статуса: 500 RuntimeError), но на сервере на laravel лог нет ошибок
а если пройти на страницу по nuxt-link то все работает, но открыв исходный код там висит ошибка 500
не работает именно SSR
ранее все работало, после build фронта начало все это,
локально кстати все работает и конфигурацию сервера не изменял

вопрос куда копать?

catalog

1、 Source of the problem

2、 Solutions

3、 Solutions

4、 Summary


1、 Source of the problem

Usually using nuxt and deploying it online are normal, and occasionally 500 errors are reported one day;

Nuxt.js The operation ( NPM run dev ) reported the following error:

The server error log is as follows:

0|qiu  |  ERROR  Request failed with status code 500                           20:17:14
0|qiu  |   at createError (node_modules/axios/lib/core/createError.js:16:15)
0|qiu  |   at settle (node_modules/axios/lib/core/settle.js:18:12)
0|qiu  |   at IncomingMessage.handleStreamEnd (node_modules/axios/lib/adapters/http.js:201:11)
0|qiu  |   at IncomingMessage.emit (events.js:187:15)
0|qiu  |   at IncomingMessage.EventEmitter.emit (domain.js:441:20)
0|qiu  |   at endReadableNT (_stream_readable.js:1094:12)
0|qiu  |   at process._tickCallback (internal/process/next_tick.js:63:19)

2、 Solutions

500 status code: server internal error, unable to complete the request.

Generally speaking, this problem occurs when the server code fails

So the problem lies in the back end, check the interface

3、 Solutions

Annotate the code one by one, and find an interface error in the page, so that the problem can be solved after the back-end correction;

The error of the request interface is as follows (PHP in the background)

 

It’s a clumsy way to comment the code one by one. If you can, you can directly look at the network of the console to see the interface in error;


4、 Summary

because Nuxt.js It is a framework for server-side rendering. As long as an interface in the page reports an error and the server returns an error, the front-end display page will crash;

And an interface error, nuxt only returns 500 errors, can’t directly locate the problem, need to check one by one, hope nuxt is more and more powerful

The wechat app I developed (online):
if you are interested, you can have a look at it and pay close attention to it with one click. Thank you ~
1. Xiaolv depression Test Assistant (wechat APP): a completely free and ad free depression self-test app, which collects questionnaires from global authorities and provides them to you for free. There are novel score records and posters to share, You can see and learn!

Xiaolv depression test assistant

Read More:

Environment

  • Operating System: Darwin
  • Node Version: v18.7.0
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

We have the same problem on Windows and when deploying to Netlify.

Reproduction

https://github.com/DenFin/nuxt3-reproduction
https://github.com/DenFin/vue3-library-reproduction

Go to vue3-library-reproduction. Run npm pack. Copy path to .tgz. Go to nuxt3-reproduction and paste path to vue3-library-reproduction.tgz in the package.json. Run yarn generate.

Describe the bug

Disclaimer: I am not sure if this is a problem with Nuxt or with Vite. Since it’s an error message by Nuxt I decided to ask here.

We have a custom component library built with Vue 3. This component library is used in a Nuxt 3 project. Now we added our first component with external css, namely Swiper.js. When we execute yarn generate we get the error [nuxt] [request error] [unhandled] [500] Unknown file extension «.css». The problem only occurs with yarn generate. If we run yarn build it works.

We tried a lot of different settings both in the Vue and the Nuxt project. Nothing worked.

What really confuses me, is that the error message does not say cannot resolve file or something similar, but that it doesn’t know .css

I set up to minimal reproduction projects. Are we missing any specific configuration for Vite?

Additional context

No response

Logs

ERROR  [nuxt] [request error] [unhandled] [500] Unknown file extension ".css" for /Users/username/Workspace/Sandbox/nuxt3-reproduction/node_modules/swiper/swiper.min.css                                                  08:07:45
  at new NodeError (node:internal/errors:387:5)  
  at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:80:11)  
  at defaultGetFormat (node:internal/modules/esm/get_format:122:38)  
  at defaultLoad (node:internal/modules/esm/load:81:20)  
  at nextLoad (node:internal/modules/esm/loader:173:28)  
  at ESMLoader.load (node:internal/modules/esm/loader:616:26)  
  at ESMLoader.moduleProvider (node:internal/modules/esm/loader:472:22)  
  at new ModuleJob (node:internal/modules/esm/module_job:63:26)  
  at #createModuleJob (node:internal/modules/esm/loader:491:17)  
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:449:34)

Понравилась статья? Поделить с друзьями:
  • Nuova simonelli microbar 2 ошибка группы
  • Numpy средняя ошибка
  • Numpy среднеквадратичная ошибка
  • Numpy ошибка установки
  • Numplate light ошибка bmw