next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

Problem with building example-marketing.

Open xavier-xia-99 opened this issue 1 year ago • 0 comments

Package

example-marketing

Ask the question

I am unable to build locally or on Vercel this example. Really appreciate any advice as I have little frontend experience.

There are other fixes I had to do up to this point, not sure if they are right.

  1. update next.config.js images field to an array

images: { domains: process.env.NEXT_IMAGE_DOMAIN ? [process.env.NEXT_IMAGE_DOMAIN] : [], },

  1. update the import for domhandler in formatted-text.tsx from import { Element } from "domhandler/lib/node" to import { Element } from "domhandler"

  2. renamed env .env.example to just .env

Additional context

Ran into this error message on both local and Vercel build attempts:

Local Error :

❯ npm run build

> [email protected] build
> next build && next export

info  - Loaded env from /Users/boxia/Projects/drupal-nextjs-marketing-site/.env
info  - Linting and checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully
info  - Collecting page data ..[next-drupal][error]: Error: Failed to fetch JSON:API index at http://localhost:8080/es/jsonapi - fetch failed
    at /Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next-drupal/dist/index.js:2053:28
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 1)
    at async Promise.all (index 0)
    at async getStaticPaths (/Users/boxia/Projects/drupal-nextjs-marketing-site/.next/server/pages/[[...slug]].js:121:16)
    at async buildStaticPaths (/Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next/dist/build/utils.js:592:33)
    at async /Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next/dist/build/utils.js:886:115
    at async Span.traceAsyncFn (/Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next/dist/trace/trace.js:79:20)
TypeError: Cannot read properties of undefined (reading 'links')
    at /Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next-drupal/dist/index.js:2075:42
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 1)
    at async Promise.all (index 0)
    at async getStaticPaths (/Users/boxia/Projects/drupal-nextjs-marketing-site/.next/server/pages/[[...slug]].js:121:16)
    at async buildStaticPaths (/Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next/dist/build/utils.js:592:33)
    at async /Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next/dist/build/utils.js:886:115
    at async Span.traceAsyncFn (/Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next/dist/trace/trace.js:79:20)

> Build error occurred
Error: Failed to collect page data for /[[...slug]]
    at /Users/boxia/Projects/drupal-nextjs-marketing-site/node_modules/next/dist/build/utils.js:916:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}

Vercel Error : Vercel App Github Repo

xavier-xia-99 avatar Mar 27 '24 16:03 xavier-xia-99