nuxt-themes / docus

Write beautiful documentations with Nuxt and Markdown.

Home Page:https://docus.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with npx nuxt generate Command When Using ssr: false Configuration in nuxt.config.js

frs99 opened this issue · comments

Problem Description:

I am using Nuxt.js to develop a web application and I'm encountering an issue when trying to generate the project using the command npx nuxt generate with the ssr configuration in the nuxt.config.js file set to false. This issue does not occur when the ssr value is set to true. I hope you can assist me in understanding the cause and finding a solution to this problem.

Steps Taken:

  1. I modify the Nuxt configuration file (nuxt.config.ts) to look like the following:

    // nuxt.config.ts
    
    export default defineNuxtConfig({
       app: {
         buildAssetsDir: 'nuxt',
       },
       ssr: false,
       // https://github.com/nuxt-themes/docus
       extends: '@nuxt-themes/docus',
       
       modules: [
         // https://github.com/nuxt-modules/plausible
         '@nuxtjs/plausible',
         // https://github.com/nuxt/devtools
         '@nuxt/devtools'
       ]
     })
    
    
  2. Then I execute the following command to generate the project:

    npx nuxt generate

Issue:

When executing the command npx nuxt generate with ssr: false, an error occurs during the generation process, and the following message appears:

ERROR [nuxt] [request error] [unhandled] [500] Unexpected token '<', "<!DOCTYPE "... is not valid JSON
  at JSON.parse (<anonymous>)
  at parseJSONFromBytes (node:internal/deps/undici/undici:6662:19)
  at successSteps (node:internal/deps/undici/undici:6636:27)
  at node:internal/deps/undici/undici:1236:60
  at node:internal/process/task_queues:140:7
  at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
  at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)

 ├─ /__studio.json (1217ms) (Error: [500] )
 ├─ / (1217ms)
 ├─ /index.html (1213ms)
 ├─ /404.html (1213ms)
 ├─ /200.html (1213ms)
 ├─ /api/search (2323ms)
 ├─ /api/_content/cache.1692048783655.json (2378ms)
Errors prerendering:
  ├─ /__studio.json (500)
 ERROR  Exiting due to prerender errors.

Actions Taken:

  1. I have read the Nuxt documentation regarding project generation and understanding how to set ssr to false.
  2. I tried executing the npx nuxt generate command with ssr: true, and no errors occurred.

Expected Outcome:

I expect there to be a way to generate the project using ssr: false without encountering the aforementioned errors. I kindly request guidance towards a suitable solution for this issue.

I have the same problem, were you able to solve it?

I have the same problem, were you able to solve it?

no bro