I have created a Next.js project locally and have committed to GitHub. I have also connected my Netlify account to GitHub and tried to deploy the project which fails. I do have the Essential Next.js plugin installed.
Here is my error log which says this site doesn’t seem to be using Next.js which I don’t understand. In my package.json file Next is there…
3:44:31 PM: ❯ Installing plugins
3:44:31 PM: - @netlify/plugin-nextjs@3.8.0
3:44:51 PM:
3:44:51 PM: ❯ Loading plugins
3:44:51 PM: - @netlify/plugin-nextjs@3.8.0 from Netlify app
3:44:52 PM:
3:44:52 PM: ────────────────────────────────────────────────────────────────
3:44:52 PM: 1. onPreBuild command from @netlify/plugin-nextjs
3:44:52 PM: ────────────────────────────────────────────────────────────────
3:44:52 PM:
3:44:52 PM:
3:44:52 PM: ────────────────────────────────────────────────────────────────
3:44:52 PM: Plugin "@netlify/plugin-nextjs" failed
3:44:52 PM: ────────────────────────────────────────────────────────────────
3:44:52 PM:
3:44:52 PM: Error message
3:44:52 PM: Error: This site does not seem to be using Next.js. Please run "npm install next" in the repository.
3:44:52 PM: If you are using a monorepo, please see the docs on configuring your site: https://ntl.fyi/next-monorepos
3:44:52 PM:
3:44:52 PM: Plugin details
3:44:52 PM: Package: @netlify/plugin-nextjs
3:44:52 PM: Version: 3.8.0
3:44:52 PM: Repository: git+https://github.com/netlify/netlify-plugin-nextjs.git
3:44:52 PM: npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs
3:44:52 PM: Report issues: https://github.com/netlify/netlify-plugin-nextjs/issues
3:44:52 PM:
3:44:52 PM: Error location
3:44:52 PM: In "onPreBuild" event in "@netlify/plugin-nextjs" from Netlify app
3:44:52 PM: at validateNextUsage (/.netlify/plugins/node_modules/@netlify/plugin-nextjs/helpers/validateNextUsage.js:15:12)
3:44:52 PM: at onPreBuild (/.netlify/plugins/node_modules/@netlify/plugin-nextjs/index.js:28:5)
3:44:52 PM:
3:44:52 PM: Resolved config
3:44:52 PM: build:
3:44:52 PM: command: npm run build
3:44:52 PM: commandOrigin: ui
3:44:52 PM: publish: /opt/build/repo/out
3:44:52 PM: publishOrigin: ui
3:44:52 PM: plugins:
3:44:52 PM: - inputs: {}
3:44:52 PM: origin: ui
3:44:52 PM: package: '@netlify/plugin-nextjs'
3:44:52 PM: Caching artifacts
3:44:52 PM: Started saving build plugins
3:44:52 PM: Finished saving build plugins
3:44:52 PM: Started saving pip cache
3:44:52 PM: Finished saving pip cache
3:44:52 PM: Started saving emacs cask dependencies
3:44:52 PM: Finished saving emacs cask dependencies
3:44:52 PM: Started saving maven dependencies
3:44:52 PM: Finished saving maven dependencies
3:44:52 PM: Started saving boot dependencies
3:44:52 PM: Finished saving boot dependencies
3:44:52 PM: Started saving rust rustup cache
3:44:52 PM: Finished saving rust rustup cache
3:44:52 PM: Started saving go dependencies
3:44:52 PM: Finished saving go dependencies
3:44:55 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:44:55 PM: Creating deploy upload records
3:44:55 PM: Failing build: Failed to build site
3:44:55 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
3:44:55 PM: Finished processing build request in 29.572822475s