next-drupal
next-drupal copied to clipboard
Problem with building example-marketing.
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.
- update
next.config.jsimages field to an array
images: { domains: process.env.NEXT_IMAGE_DOMAIN ? [process.env.NEXT_IMAGE_DOMAIN] : [], },
-
update the import for domhandler in
formatted-text.tsxfromimport { Element } from "domhandler/lib/node"toimport { Element } from "domhandler" -
renamed env
.env.exampleto 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