decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.7k stars 3.03k forks source link

A build fails, while creating nextjs blog template #6991

Closed LukasBicus closed 5 months ago

LukasBicus commented 7 months ago

Describe the bug I'm unable to create nextjs blog template

To Reproduce Steps to reproduce the behavior. For example:

  1. Go to start with a template doc page
  2. Click on 'Next.js Blog Template - Deploy to netlify' button
  3. I'm redirected to https://app.netlify.com/
  4. Waiting for a template deploy
  5. A build step of deploy fails, (see screenshot/log bellow)
  6. My repository stays empty (see https://github.com/LukasBIcus/nextjs-netlify-blog-template-3, https://github.com/LukasBIcus/nextjs-netlify-blog-template-2, https://github.com/LukasBIcus/nextjs-netlify-blog-template)

Expected behavior I expect starter template to work. I expect, that template code appears in my repository.

Screenshots image

Log

3:06:09 PM: Netlify Build                                                 
3:06:09 PM: ────────────────────────────────────────────────────────────────
3:06:09 PM: ​
3:06:09 PM: ❯ Version
3:06:09 PM:   @netlify/build 29.28.2
3:06:09 PM: ​
3:06:09 PM: ❯ Flags
3:06:09 PM:   baseRelDir: true
3:06:09 PM:   buildId: 6560adabf30338285aa7e9c0
3:06:09 PM:   deployId: 6560adabf30338285aa7e9c2
3:06:09 PM: ​
3:06:09 PM: ❯ Current directory
3:06:09 PM:   /opt/build/repo
3:06:09 PM: ​
3:06:09 PM: ❯ Config file
3:06:09 PM:   /opt/build/repo/netlify.toml
3:06:09 PM: ​
3:06:09 PM: ❯ Context
3:06:09 PM:   production
3:06:09 PM: ​
3:06:09 PM: build.command from netlify.toml                               
3:06:09 PM: ────────────────────────────────────────────────────────────────
3:06:09 PM: ​
3:06:09 PM: $ npm run export
3:06:10 PM: > my-app@0.1.1 export
3:06:10 PM: > next build && next export -o ./dist
3:06:10 PM: Browserslist: caniuse-lite is outdated. Please run:
3:06:10 PM: npx browserslist@latest --update-db
3:06:10 PM: Why you should do it regularly:
3:06:10 PM: https://github.com/browserslist/browserslist#browsers-data-updating
3:06:10 PM: node:internal/errors:496
3:06:10 PM:     ErrorCaptureStackTrace(err);
3:06:10 PM:     ^
3:06:10 PM: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath "./lib/parser" is not defined by "exports" in /opt/build/repo/node_modules/next/node_modules/postcss/package.json
3:06:10 PM:     at new NodeError (node:internal/errors:405:5)
3:06:10 PM:     at exportsNotFound (node:internal/modules/esm/resolve:362:10)
3:06:10 PM:     at packageExportsResolve (node:internal/modules/esm/resolve:698:9)
3:06:10 PM:     at resolveExports (node:internal/modules/cjs/loader:567:36)
3:06:10 PM:     at Module._findPath (node:internal/modules/cjs/loader:636:31)
3:06:10 PM:     at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
3:06:10 PM:     at Module._load (node:internal/modules/cjs/loader:922:27)
3:06:10 PM:     at Module.require (node:internal/modules/cjs/loader:1143:19)
3:06:10 PM:     at require (node:internal/modules/cjs/helpers:119:18)
3:06:10 PM:     at 552 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11590)
3:06:10 PM:     at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
3:06:10 PM:     at 270 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:400)
3:06:10 PM:     at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
3:06:10 PM:     at 327 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:260)
3:06:10 PM:     at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
3:06:10 PM:     at 845 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:3733) {
3:06:10 PM:   code: "ERR_PACKAGE_PATH_NOT_EXPORTED"
3:06:10 PM: }
3:06:10 PM: Node.js v18.18.2
3:06:10 PM: ​
3:06:10 PM: "build.command" failed                                        
3:06:10 PM: ────────────────────────────────────────────────────────────────
3:06:10 PM: ​
3:06:10 PM:   Error message
3:06:10 PM:   Command failed with exit code 1: npm run export (https://ntl.fyi/exit-code-1)
3:06:10 PM: ​
3:06:10 PM:   Error location
3:06:10 PM:   In build.command from netlify.toml:
3:06:10 PM:   npm run export
3:06:10 PM: ​
3:06:10 PM:   Resolved config
3:06:10 PM:   build:
3:06:10 PM:     command: npm run export
3:06:10 PM:     commandOrigin: config
3:06:10 PM:     publish: /opt/build/repo/dist
3:06:10 PM:     publishOrigin: config
3:06:11 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:06:11 PM: Failing build: Failed to build site
3:06:11 PM: Finished processing build request in 39.021s
3:06:11 PM: Failed during stage "building site": Build script returned non-zero exit code: 2

Applicable Versions:

martinjagodic commented 7 months ago

@LukasBicus this is actually a problem with the template at https://github.com/wutali/nextjs-netlify-blog-template

I guess we will have to create our own template, as this one doesn't seem to be maintained.