Good evening. I have a React project ( (https://404projectschool.netlify.app/) ) and when i try to deploy it on netlify.com i get this error:
Netlify Build
8:56:08 PM: ────────────────────────────────────────────────────────────────
8:56:08 PM:
8:56:08 PM: ❯ Version
8:56:08 PM: @netlify/build 29.46.5
8:56:08 PM:
8:56:08 PM: ❯ Flags
8:56:08 PM: baseRelDir: true
8:56:08 PM: buildId: 6660c2a46d21f100080bdca4
8:56:08 PM: deployId: 6660c2a46d21f100080bdca6
8:56:08 PM:
8:56:08 PM: ❯ Current directory
8:56:08 PM: /opt/build/repo
8:56:08 PM:
8:56:08 PM: ❯ Config file
8:56:08 PM: /opt/build/repo/netlify.toml
8:56:08 PM:
8:56:08 PM: ❯ Context
8:56:08 PM: production
8:56:08 PM:
8:56:08 PM: ❯ Using Next.js Runtime - v4.41.3
8:56:08 PM:
8:56:08 PM: ❯ Loading plugins
8:56:08 PM: - @netlify/plugin-lighthouse@6.0.0 from Netlify app
8:56:08 PM:
8:56:08 PM: ❯ Outdated plugins
8:56:08 PM: - @netlify/plugin-nextjs@4.41.3: latest version is 5.3.2
8:56:08 PM: To upgrade this plugin, please uninstall and re-install it from the Netlify plugins directory (Netlify App)
8:56:10 PM: No Next.js cache to restore.
8:56:10 PM:
8:56:10 PM: build.command from netlify.toml
8:56:10 PM: ──────────────────────────────────────────────────────────────────
8:56:22 PM:
8:56:22 PM: Error message
8:56:22 PM: Error: The directory “/opt/build/repo/build” does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
8:56:22 PM: In most cases it should be set to “.next”, unless you have chosen a custom “distDir” in your Next config.
8:56:22 PM: If you are using “next export” then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to “true”.
8:56:22 PM:
8:56:22 PM: Plugin details
8:56:22 PM: Package: @netlify/plugin-nextjs
8:56:22 PM: Version: 4.41.3
8:56:22 PM: Repository: git+https://github.com/netlify/next-runtime.git
8:56:22 PM: npm link: @netlify/plugin-nextjs - npm
8:56:22 PM: Report issues: Issues · netlify/next-runtime · GitHub
8:56:22 PM:
8:56:22 PM: Error location
8:56:22 PM: In “onBuild” event in “@netlify/plugin-nextjs” from Netlify app
8:56:22 PM:
8:56:22 PM: Resolved config
8:56:22 PM: build:
8:56:22 PM: command: npm run build
8:56:22 PM: commandOrigin: config
8:56:22 PM: environment:
8:56:22 PM: - REACT_APP_FIREBASE_API_KEY
8:56:22 PM: - REACT_APP_FIREBASE_AUTH_DOMAIN
8:56:22 PM: - REACT_APP_STRIPE_KEY
8:56:22 PM: - SENDGRID_API_KEY
8:56:22 PM: - SENDGRID_TEMPLATE_ID
8:56:22 PM: - NEXT_PRIVATE_TARGET
8:56:22 PM: publish: /opt/build/repo/build
8:56:22 PM: publishOrigin: config
8:56:22 PM: functionsDirectory: /opt/build/repo/netlify/functions
8:56:22 PM: plugins:
8:56:22 PM: - inputs: {}
8:56:22 PM: origin: ui
8:56:22 PM: package: ‘@netlify/plugin-nextjs’
8:56:22 PM: - inputs: {}
8:56:22 PM: origin: ui
8:56:22 PM: package: ‘@netlify/plugin-lighthouse’
8:56:22 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:56:23 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:56:23 PM: Failing build: Failed to build site
8:56:23 PM: Finished processing build request in 43.588s
my netlify.toml file is:
[build]
command = “npm run build”
publish = “build”