Plugin "@netlify/plugin-nextjs" failed, WHY?

Hi, I m new frensh build the site " Next.js Blog Template"
I have use button install site, but always met this problem.
Do you know what caused it ?

6:44:57 PM: ────────────────────────────────────────────────────────────────
6:44:57 PM: Plugin “@netlify/plugin-nextjs” failed
6:44:57 PM: ────────────────────────────────────────────────────────────────
6:44:57 PM: ​
6:44:57 PM: Error message
6:44:57 PM: Error: The directory “dist” does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
6:44:57 PM: In most cases it should be set to “.next”, unless you have chosen a custom “distDir” in your Next config.
6:44:57 PM: If you are using “next export” then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to “true”.
6:44:57 PM: ​
6:44:57 PM: Plugin details
6:44:57 PM: Package: @netlify/plugin-nextjs
6:44:57 PM: Version: 4.2.2
6:44:57 PM: Repository: git+https://github.com/netlify/netlify-plugin-nextjs.git
6:44:57 PM: npm link: @netlify/plugin-nextjs - npm
6:44:57 PM: Report issues: Issues · netlify/next-runtime · GitHub
6:44:57 PM: ​
6:44:57 PM: Error location
6:44:57 PM: In “onBuild” event in “@netlify/plugin-nextjs” from Netlify app
6:44:57 PM: at checkNextSiteHasBuilt (/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/helpers/verification.js:68:16)
6:44:57 PM: at onBuild (/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/index.js:37:50)
6:44:57 PM: ​
6:44:57 PM: Resolved config
6:44:57 PM: build:
6:44:57 PM: command: npm run export
6:44:57 PM: commandOrigin: config
6:44:57 PM: environment:
6:44:57 PM: - NEXT_PRIVATE_TARGET
6:44:57 PM: publish: /opt/build/repo/dist
6:44:57 PM: publishOrigin: config
6:44:57 PM: plugins:
6:44:57 PM: - inputs: {}
6:44:57 PM: origin: ui
6:44:57 PM: package: ‘@netlify/plugin-nextjs’

The error seems to be in the build settings. What are you using as a build command and build folder?

2 Likes