Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
frs99 opened this issue Aug 14, 2023 · 2 comments

Comments

@frs99
Copy link

frs99 commented Aug 14, 2023

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.

@BrunoGGM
Copy link

BrunoGGM commented Oct 9, 2023

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

@frs99
Copy link
Author

frs99 commented Oct 10, 2023

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

no bro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants