Build error..exit code 1

keep getting this error

“build.command” failed
9:01:38 PM: ─────
9:01:38 PM: ​
9:01:38 PM: Error message
9:01:38 PM: Command failed with exit code 1: npm run export
9:01:38 PM: ​
9:01:38 PM: Error location
9:01:38 PM: In build.command from netlify.toml:
9:01:38 PM: npm run export

Here is what is in my paackage.json

“scripts”: {
“dev”: “next dev”,
“build”: “next build”,
“start”: “next start”,
“export”: “next build && next export -o ./dist”,
“test”: “jest”

Here is what is in my netlify.toml

[build]
publish = “dist”
command = “npm run export”

Changing build to ‘CI= npm run build’ in netlify settiings did not work
Thank you!

You’ve trimmed the build, so we can’t guess it. Kindly post the full log.

Hi thank you!

8:59:54 PM: Build ready to start
8:59:56 PM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
8:59:56 PM: build-image tag: v3.7.1
8:59:56 PM: buildbot version: b47b671c7e5601877c51968241eb899bf590a815
8:59:56 PM: Building without cache
8:59:56 PM: Starting to prepare the repo for build
8:59:57 PM: No cached dependencies found. Cloning fresh repo
8:59:57 PM: git clone git@github.com:Star890/nextjs-netlify-blog-template
8:59:58 PM: Preparing Git Reference refs/heads/master
9:00:00 PM: Starting build script
9:00:00 PM: Installing dependencies
9:00:00 PM: Python version set to 2.7
9:00:01 PM: v12.18.0 is already installed.
9:00:02 PM: Now using node v12.18.0 (npm v6.14.4)
9:00:02 PM: Started restoring cached build plugins
9:00:02 PM: Finished restoring cached build plugins
9:00:02 PM: Attempting ruby version 2.7.1, read from environment
9:00:04 PM: Using ruby version 2.7.1
9:00:04 PM: Using PHP version 5.6
9:00:04 PM: Started restoring cached yarn cache
9:00:04 PM: Finished restoring cached yarn cache
9:00:04 PM: Installing yarn at version 1.22.4
9:00:04 PM: Installing Yarn!
9:00:04 PM: > Downloading tarball…
9:00:04 PM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz → /tmp/yarn.tar.gz.Etob1S5Zyw
9:00:04 PM: % Total % Received % Xferd Average Speed Time Time Time Current
9:00:04 PM: Dload Upload Total Spent Left Speed
9:00:04 PM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
9:00:04 PM: 100 79 100 79 0 0 351 0 --:–:-- --:–:-- --:–:-- 352
9:00:04 PM: 100 93 100 93 0 0 187 0 --:–:-- --:–:-- --:–:-- 187
9:00:05 PM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
9:00:05 PM: 100 625 100 625 0 0 811 0 --:–:-- --:–:-- --:–:-- 14204
9:00:05 PM: 100 1215k 100 1215k 0 0 1014k 0 0:00:01 0:00:01 --:–:-- 1014k
9:00:05 PM: [2/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc → /tmp/yarn.tar.gz.Etob1S5Zyw.asc
9:00:05 PM: 100 83 100 83 0 0 923 0 --:–:-- --:–:-- --:–:-- 923
9:00:05 PM: 100 97 100 97 0 0 816 0 --:–:-- --:–:-- --:–:-- 816
9:00:05 PM: 100 629 100 629 0 0 4339 0 --:–:-- --:–:-- --:–:-- 4339
9:00:05 PM: 100 1028 100 1028 0 0 6527 0 --:–:-- --:–:-- --:–:-- 6527
9:00:05 PM: > Verifying integrity…
9:00:05 PM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
9:00:05 PM: gpg: Good signature from “Yarn Packaging yarn@dan.cx
9:00:05 PM: gpg: WARNING: This key is not certified with a trusted signature!
9:00:05 PM: gpg: There is no indication that the signature belongs to the owner.
9:00:05 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
9:00:05 PM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
9:00:05 PM: > GPG signature looks good
9:00:05 PM: > Extracting to ~/.yarn…
9:00:06 PM: > Adding to PATH... 9:00:06 PM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available. 9:00:06 PM: Started restoring cached node modules 9:00:06 PM: Finished restoring cached node modules 9:00:06 PM: Installing NPM modules using Yarn version 1.22.4 9:00:07 PM: yarn install v1.22.4 9:00:07 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. 9:00:07 PM: [1/4] Resolving packages... 9:00:08 PM: [2/4] Fetching packages... 9:00:25 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module. 9:00:25 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. 9:00:25 PM: [3/4] Linking dependencies... 9:00:25 PM: warning " > next-mdx-remote@2.1.3" has incorrect peer dependency "react@>=16.13.1 <=17.0.1". 9:00:25 PM: warning " > next-mdx-remote@2.1.3" has incorrect peer dependency "react-dom@>=16.13.1 <=17.0.1". 9:00:25 PM: warning " > react-instagram-embed@2.0.0" has incorrect peer dependency "react@^16.0.0 || ^15.0.0 || ~0.14.0". 9:00:25 PM: warning " > react-instagram-embed@2.0.0" has incorrect peer dependency "react-dom@^16.0.0 || ^15.0.0 || ~0.14.0". 9:00:25 PM: warning " > react-twitter-embed@3.0.3" has unmet peer dependency "prop-types@^15.5.4". 9:00:25 PM: warning " > react-twitter-embed@3.0.3" has incorrect peer dependency "react@^15.0.0 || ^16.0.0". 9:00:25 PM: warning " > react-twitter-embed@3.0.3" has incorrect peer dependency "react-dom@^15.0.0 || ^16.0.0". 9:00:25 PM: warning "react-twitter-embed > enzyme-adapter-react-16@1.15.6" has unmet peer dependency "enzyme@^3.0.0". 9:00:25 PM: warning "react-twitter-embed > enzyme-adapter-react-16@1.15.6" has incorrect peer dependency "react@^16.0.0-0". 9:00:25 PM: warning "react-twitter-embed > enzyme-adapter-react-16@1.15.6" has incorrect peer dependency "react-dom@^16.0.0-0". 9:00:25 PM: warning "react-twitter-embed > enzyme-adapter-react-16 > enzyme-adapter-utils@1.14.0" has incorrect peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0". 9:00:25 PM: warning "react-twitter-embed > enzyme-adapter-react-16 > react-test-renderer@16.14.0" has incorrect peer dependency "react@^16.14.0". 9:00:25 PM: warning "react-twitter-embed > enzyme-adapter-react-16 > enzyme-adapter-utils > airbnb-prop-types@2.16.0" has incorrect peer dependency "react@^0.14 || ^15.0.0 || ^16.0.0-alpha". 9:00:34 PM: [4/4] Building fresh packages... 9:00:34 PM: success Saved lockfile. 9:00:34 PM: Done in 26.87s. 9:00:34 PM: NPM modules installed using Yarn 9:00:34 PM: Started restoring cached go cache 9:00:34 PM: Finished restoring cached go cache 9:00:34 PM: go version go1.14.4 linux/amd64 9:00:34 PM: go version go1.14.4 linux/amd64 9:00:34 PM: Installing missing commands 9:00:34 PM: Verify run directory 9:00:36 PM: ​ 9:00:36 PM: ──────────────────────────────────────────────────────────────── 9:00:36 PM: Netlify Build 9:00:36 PM: ──────────────────────────────────────────────────────────────── 9:00:36 PM: ​ 9:00:36 PM: ❯ Version 9:00:36 PM: @netlify/build 11.2.2 9:00:36 PM: ​ 9:00:36 PM: ❯ Flags 9:00:36 PM: deployId: 6080d89a9e40fe184dd0c75a 9:00:36 PM: ​ 9:00:36 PM: ❯ Current directory 9:00:36 PM: /opt/build/repo 9:00:36 PM: ​ 9:00:36 PM: ❯ Config file 9:00:36 PM: /opt/build/repo/netlify.toml 9:00:36 PM: ​ 9:00:36 PM: ❯ Context 9:00:36 PM: production 9:00:37 PM: ​ 9:00:37 PM: ❯ Installing plugins 9:00:37 PM: - @netlify/plugin-nextjs@3.0.3 9:01:00 PM: ​ 9:01:00 PM: ❯ Loading plugins 9:01:00 PM: - @netlify/plugin-nextjs@3.0.3 from Netlify app 9:01:00 PM: ​ 9:01:00 PM: ──────────────────────────────────────────────────────────────── 9:01:00 PM: 1. onPreBuild command from @netlify/plugin-nextjs 9:01:00 PM: ──────────────────────────────────────────────────────────────── 9:01:00 PM: ​ 9:01:00 PM: Static HTML export Next.js projects do not require this plugin. Check your project's build command for 'next export'. ​ 9:01:00 PM: (@netlify/plugin-nextjs onPreBuild completed in 13ms) 9:01:00 PM: ​ 9:01:00 PM: ──────────────────────────────────────────────────────────────── 9:01:00 PM: 2. build.command from netlify.toml 9:01:00 PM: ──────────────────────────────────────────────────────────────── 9:01:00 PM: ​ 9:01:00 PM: npm run export
9:01:00 PM: > my-app@0.1.1 export /opt/build/repo
9:01:00 PM: > next build && next export -o ./dist
9:01:02 PM: info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
9:01:02 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
9:01:02 PM: info - Checking validity of types…
9:01:09 PM: info - Creating an optimized production build…
9:01:29 PM: info - Compiled successfully
9:01:29 PM: info - Collecting page data…
9:01:30 PM: info - Generating static pages (0/16)
9:01:33 PM: info - Generating static pages (4/16)
9:01:33 PM: info - Generating static pages (8/16)
9:01:36 PM: Error occurred prerendering page “/posts/rich-content-with-mdx”. Read more: https://nextjs.org/docs/messages/prerender-error
9:01:36 PM: SyntaxError: unknown: Expected corresponding JSX closing tag for

(11:7)
9:01:36 PM: 9 |

{## Instagram with react-instagram-embed}


9:01:36 PM: 10 |


9:01:36 PM: > 11 |


9:01:36 PM: | ^
9:01:36 PM: 12 |

{<InstagramEmbed}


9:01:36 PM: 13 |

{url="}<a parentName=“h1” {…{“href”:“https://instagr.am/p/Zw9o4/%22”}}>{https://instagr.am/p/Zw9o4/"}


9:01:36 PM: 14 |

{maxWidth={320}}


9:01:36 PM: at Object._raise (/opt/build/repo/node_modules/@babel/parser/lib/index.js:775:17)
9:01:36 PM: at Object.raiseWithData (/opt/build/repo/node_modules/@babel/parser/lib/index.js:768:17)
9:01:36 PM: at Object.raise (/opt/build/repo/node_modules/@babel/parser/lib/index.js:736:17)
9:01:36 PM: at Object.jsxParseElementAt (/opt/build/repo/node_modules/@babel/parser/lib/index.js:5135:16)
9:01:36 PM: at Object.jsxParseElementAt (/opt/build/repo/node_modules/@babel/parser/lib/index.js:5103:32)
9:01:36 PM: at Object.jsxParseElementAt (/opt/build/repo/node_modules/@babel/parser/lib/index.js:5103:32)
9:01:36 PM: at Object.jsxParseElement (/opt/build/repo/node_modules/@babel/parser/lib/index.js:5161:17)
9:01:36 PM: at Object.parseExprAtom (/opt/build/repo/node_modules/@babel/parser/lib/index.js:5168:19)
9:01:36 PM: at Object.parseExprSubscripts (/opt/build/repo/node_modules/@babel/parser/lib/index.js:10689:23)
9:01:36 PM: at Object.parseUpdate (/opt/build/repo/node_modules/@babel/parser/lib/index.js:10669:21)
9:01:37 PM: Error occurred prerendering page “/posts/welcome”. Read more: prerender-error | Next.js
9:01:37 PM: TypeError: Cannot read property ‘name’ of undefined
9:01:37 PM: at PostLayout (/opt/build/repo/.next/server/pages/posts/[post].js:963:39)
9:01:37 PM: at d (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
9:01:37 PM: at bb (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
9:01:37 PM: at a.b.render (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
9:01:37 PM: at a.b.read (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
9:01:37 PM: at exports.renderToString (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
9:01:37 PM: at Object.renderPage (/opt/build/repo/node_modules/next/dist/next-server/server/render.js:54:854)
9:01:37 PM: at Function.getInitialProps (/opt/build/repo/.next/server/pages/_document.js:719:19)
9:01:37 PM: at loadGetInitialProps (/opt/build/repo/node_modules/next/dist/next-server/lib/utils.js:5:101)
9:01:37 PM: at renderToHTML (/opt/build/repo/node_modules/next/dist/next-server/server/render.js:54:1145)
9:01:37 PM: info - Generating static pages (12/16)
9:01:37 PM: Error occurred prerendering page “/posts/fox”. Read more: prerender-error | Next.js
9:01:37 PM: TypeError: Cannot read property ‘name’ of undefined
9:01:37 PM: at /opt/build/repo/.next/server/pages/posts/[post].js:962:73
9:01:37 PM: at Array.map ()
9:01:37 PM: at PostLayout (/opt/build/repo/.next/server/pages/posts/[post].js:962:25)
9:01:37 PM: at d (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
9:01:37 PM: at bb (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
9:01:37 PM: at a.b.render (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
9:01:37 PM: at a.b.read (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
9:01:37 PM: at exports.renderToString (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
9:01:37 PM: at Object.renderPage (/opt/build/repo/node_modules/next/dist/next-server/server/render.js:54:854)
9:01:37 PM: at Function.getInitialProps (/opt/build/repo/.next/server/pages/_document.js:719:19)
9:01:38 PM: info - Generating static pages (16/16)
9:01:38 PM: > Build error occurred
9:01:38 PM: Error: Export encountered errors on following paths:
9:01:38 PM: /posts/fox
9:01:38 PM: /posts/rich-content-with-mdx
9:01:38 PM: /posts/welcome
9:01:38 PM: at /opt/build/repo/node_modules/next/dist/export/index.js:31:1106
9:01:38 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:5:584)
9:01:38 PM: at async /opt/build/repo/node_modules/next/dist/build/index.js:43:49
9:01:38 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:5:584)
9:01:38 PM: at async /opt/build/repo/node_modules/next/dist/build/index.js:25:1475
9:01:38 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:5:584)
9:01:38 PM: npm ERR! code ELIFECYCLE
9:01:38 PM: npm ERR! errno 1
9:01:38 PM: npm ERR! my-app@0.1.1 export: next build && next export -o ./dist
9:01:38 PM: npm ERR! Exit status 1
9:01:38 PM: npm ERR!
9:01:38 PM: npm ERR! Failed at the my-app@0.1.1 export script.
9:01:38 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
9:01:38 PM: npm ERR! A complete log of this run can be found in:
9:01:38 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-04-22T02_01_38_618Z-debug.log
9:01:38 PM: ​
9:01:38 PM: ────────────────────────────────────────────────────────────────
9:01:38 PM: “build.command” failed
9:01:38 PM: ────────────────────────────────────────────────────────────────
9:01:38 PM: ​
9:01:38 PM: Error message
9:01:38 PM: Command failed with exit code 1: npm run export
9:01:38 PM: ​
9:01:38 PM: Error location
9:01:38 PM: In build.command from netlify.toml:
9:01:38 PM: npm run export
9:01:38 PM: ​
9:01:38 PM: Resolved config
9:01:38 PM: build:
9:01:38 PM: command: npm run export
9:01:38 PM: commandOrigin: config
9:01:38 PM: publish: /opt/build/repo/dist
9:01:38 PM: plugins:
9:01:38 PM: - inputs: {}
9:01:38 PM: origin: ui
9:01:38 PM: package: ‘@netlify/plugin-nextjs’
9:01:39 PM: Caching artifacts
9:01:39 PM: Started saving node modules
9:01:39 PM: Finished saving node modules
9:01:39 PM: Started saving build plugins
9:01:39 PM: Finished saving build plugins
9:01:39 PM: Started saving yarn cache
9:01:39 PM: Finished saving yarn cache
9:01:39 PM: Started saving pip cache
9:01:39 PM: Finished saving pip cache
9:01:39 PM: Started saving emacs cask dependencies
9:01:39 PM: Finished saving emacs cask dependencies
9:01:39 PM: Started saving maven dependencies
9:01:39 PM: Finished saving maven dependencies
9:01:39 PM: Started saving boot dependencies
9:01:39 PM: Finished saving boot dependencies
9:01:39 PM: Started saving rust rustup cache
9:01:39 PM: Finished saving rust rustup cache
9:01:39 PM: Started saving go dependencies
9:01:39 PM: Finished saving go dependencies
9:01:42 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:01:42 PM: Creating deploy upload records
9:01:42 PM: Failing build: Failed to build site
9:01:42 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
9:01:42 PM: Finished processing build request in 1m45.993056308s

If you follow the link, you get some steps regarding what you can do: prerender-error | Next.js

Thank you, I ended up having to remove those posts!