Skip to content

Deploy failed due to an error in @netlify/plugin-nextjs plugin. #41

@0xMALVEE

Description

@0xMALVEE

Deploy summary

Plugin "@netlify/plugin-nextjs" failed

Error: The directory "/opt/build/repo/dist" does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
However, a '.next' directory was found with a production build.
Consider changing your 'publish' directory to '.next'
If you are using "next export" then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to "true".

DEPLOY LOGS

4:37:18 AM: Build ready to start
4:37:25 AM: build-image version: 9289b698a503f132b265bd089ab40ce1d6f9e65e (focal)
4:37:25 AM: build-image tag: v4.12.0
4:37:25 AM: buildbot version: c87074660cd9a4568c0ac759bc083987e94204b3
4:37:26 AM: Fetching cached dependencies
4:37:26 AM: Failed to fetch cache, continuing with build
4:37:26 AM: Starting to prepare the repo for build
4:37:26 AM: No cached dependencies found. Cloning fresh repo
4:37:26 AM: git clone https://github.com/wutali/nextjs-netlify-blog-template
4:37:26 AM: Preparing Git Reference refs/heads/master
4:37:26 AM: Parsing package.json dependencies
4:37:27 AM: Starting build script
4:37:27 AM: Installing dependencies
4:37:27 AM: Python version set to 2.7
4:37:28 AM: v16.17.1 is already installed.
4:37:28 AM: Now using node v16.17.1 (npm v8.15.0)
4:37:28 AM: Started restoring cached build plugins
4:37:28 AM: Finished restoring cached build plugins
4:37:28 AM: Attempting ruby version 2.7.2, read from environment
4:37:29 AM: Using ruby version 2.7.2
4:37:29 AM: Using PHP version 8.0
4:37:29 AM: Started restoring cached yarn cache
4:37:29 AM: Finished restoring cached yarn cache
4:37:30 AM: No yarn workspaces detected
4:37:30 AM: Started restoring cached node modules
4:37:30 AM: Finished restoring cached node modules
4:37:30 AM: Installing NPM modules using Yarn version 1.22.19
4:37:30 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:37:30 AM: npm WARN config location in the cache, and they are managed by
4:37:30 AM: npm WARN config cacache.
4:37:30 AM: yarn install v1.22.19
4:37:30 AM: 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.
4:37:30 AM: [1/4] Resolving packages...
4:37:31 AM: [2/4] Fetching packages...
4:37:40 AM: [3/4] Linking dependencies...
4:37:40 AM: warning " > next-mdx-remote@2.1.3" has incorrect peer dependency "react@>=16.13.1 <=17.0.1".
4:37:40 AM: warning " > next-mdx-remote@2.1.3" has incorrect peer dependency "react-dom@>=16.13.1 <=17.0.1".
4:37:40 AM: warning " > react-instagram-embed@2.0.0" has incorrect peer dependency "react@^16.0.0 || ^15.0.0 || ~0.14.0".
4:37:40 AM: warning " > react-instagram-embed@2.0.0" has incorrect peer dependency "react-dom@^16.0.0 || ^15.0.0 || ~0.14.0".
4:37:40 AM: warning " > react-twitter-embed@3.0.3" has unmet peer dependency "prop-types@^15.5.4".
4:37:40 AM: warning " > react-twitter-embed@3.0.3" has incorrect peer dependency "react@^15.0.0 || ^16.0.0".
4:37:40 AM: warning " > react-twitter-embed@3.0.3" has incorrect peer dependency "react-dom@^15.0.0 || ^16.0.0".
4:37:40 AM: warning "react-twitter-embed > enzyme-adapter-react-16@1.15.6" has unmet peer dependency "enzyme@^3.0.0".
4:37:40 AM: warning "react-twitter-embed > enzyme-adapter-react-16@1.15.6" has incorrect peer dependency "react@^16.0.0-0".
4:37:40 AM: warning "react-twitter-embed > enzyme-adapter-react-16@1.15.6" has incorrect peer dependency "react-dom@^16.0.0-0".
4:37:40 AM: 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".
4:37:40 AM: warning "react-twitter-embed > enzyme-adapter-react-16 > react-test-renderer@16.14.0" has incorrect peer dependency "react@^16.14.0".
4:37:40 AM: 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".
4:37:44 AM: [4/4] Building fresh packages...
4:37:44 AM: success Saved lockfile.
4:37:44 AM: Done in 13.33s.
4:37:44 AM: NPM modules installed using Yarn
4:37:44 AM: Started restoring cached go cache
4:37:44 AM: Finished restoring cached go cache
4:37:44 AM: Installing Go version 1.17 (requested 1.17)
4:37:48 AM: unset GOOS;
4:37:48 AM: unset GOARCH;
4:37:48 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
4:37:48 AM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
4:37:48 AM: go version >&2;
4:37:48 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
4:37:48 AM: go version go1.17 linux/amd64
4:37:48 AM: Installing missing commands
4:37:48 AM: Verify run directory
4:37:49 AM: ​
4:37:49 AM: ────────────────────────────────────────────────────────────────
4:37:49 AM: Netlify Build
4:37:49 AM: ────────────────────────────────────────────────────────────────
4:37:49 AM: ​
4:37:49 AM: ❯ Version
4:37:49 AM: @netlify/build 27.20.1
4:37:49 AM: ​
4:37:49 AM: ❯ Flags
4:37:49 AM: baseRelDir: true
4:37:49 AM: buildId: 63449e9de92aae0248d9b3f9
4:37:49 AM: deployId: 63449e9de92aae0248d9b3fb
4:37:49 AM: ​
4:37:49 AM: ❯ Current directory
4:37:49 AM: /opt/build/repo
4:37:49 AM: ​
4:37:49 AM: ❯ Config file
4:37:49 AM: /opt/build/repo/netlify.toml
4:37:49 AM: ​
4:37:49 AM: ❯ Context
4:37:49 AM: production
4:37:49 AM: ​
4:37:49 AM: ❯ Installing plugins
4:37:49 AM: - @netlify/plugin-nextjs@4.24.3
4:37:57 AM: ​
4:37:57 AM: ❯ Using Next.js Runtime - v4.24.3
4:37:58 AM: ​
4:37:58 AM: ────────────────────────────────────────────────────────────────
4:37:58 AM: 1. @netlify/plugin-nextjs (onPreBuild event)
4:37:58 AM: ────────────────────────────────────────────────────────────────
4:37:58 AM: ​
4:37:58 AM: No Next.js cache to restore.
4:37:58 AM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
4:37:58 AM: ​
4:37:58 AM: (@netlify/plugin-nextjs onPreBuild completed in 18ms)
4:37:58 AM: ​
4:37:58 AM: ────────────────────────────────────────────────────────────────
4:37:58 AM: 2. build.command from netlify.toml
4:37:58 AM: ────────────────────────────────────────────────────────────────
4:37:58 AM: ​
4:37:58 AM: $ npm run export
4:37:58 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:37:58 AM: npm WARN config location in the cache, and they are managed by
4:37:58 AM: npm WARN config cacache.
4:37:58 AM: > my-app@0.1.1 export
4:37:58 AM: > next build && next export -o ./dist
4:37:58 AM: Browserslist: caniuse-lite is outdated. Please run:
4:37:58 AM: npx browserslist@latest --update-db
4:37:58 AM: Why you should do it regularly:
4:37:58 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:37:58 AM: (node:1698) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /opt/build/repo/node_modules/next/node_modules/postcss/package.json.
4:37:58 AM: Update this package.json to use a subpath pattern like "./*".
4:37:58 AM: (Use node --trace-deprecation ... to show where the warning was created)
4:37:59 AM: info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
4:37:59 AM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
4:37:59 AM: info - Checking validity of types...
4:38:02 AM: info - Creating an optimized production build...
4:38:02 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:02 AM: npx browserslist@latest --update-db
4:38:02 AM: Why you should do it regularly:
4:38:02 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:06 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:06 AM: npx browserslist@latest --update-db
4:38:06 AM: Why you should do it regularly:
4:38:06 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:10 AM: info - Compiled successfully
4:38:10 AM: info - Collecting page data...
4:38:11 AM: info - Generating static pages (0/17)
4:38:13 AM: info - Generating static pages (4/17)
4:38:13 AM: info - Generating static pages (8/17)
4:38:14 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:14 AM: npx browserslist@latest --update-db
4:38:14 AM: Why you should do it regularly:
4:38:14 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:14 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:14 AM: npx browserslist@latest --update-db
4:38:14 AM: Why you should do it regularly:
4:38:14 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:14 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:14 AM: npx browserslist@latest --update-db
4:38:14 AM: Why you should do it regularly:
4:38:14 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:14 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:14 AM: npx browserslist@latest --update-db
4:38:14 AM: Why you should do it regularly:
4:38:14 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:14 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:14 AM: npx browserslist@latest --update-db
4:38:14 AM: Why you should do it regularly:
4:38:14 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:14 AM: info - Generating static pages (12/17)
4:38:14 AM: Browserslist: caniuse-lite is outdated. Please run:
4:38:14 AM: npx browserslist@latest --update-db
4:38:14 AM: Why you should do it regularly:
4:38:14 AM: https://github.com/browserslist/browserslist#browsers-data-updating
4:38:14 AM: info - Generating static pages (17/17)
4:38:14 AM: info - Finalizing page optimization...
4:38:15 AM: Page Size First Load JS
4:38:15 AM: ┌ ○ / 2.54 kB 74.6 kB
4:38:15 AM: ├ /_app 0 B 63.8 kB
4:38:15 AM: ├ ○ /404 2.77 kB 66.6 kB
4:38:15 AM: ├ ● /posts 1.35 kB 80.9 kB
4:38:15 AM: ├ ● /posts/[post] 16.6 kB 96.1 kB
4:38:15 AM: ├ └ css/d9f998f12db559bf9cc0.css 631 B
4:38:15 AM: ├ ├ /posts/welcome
4:38:15 AM: ├ ├ /posts/markdown-syntax
4:38:15 AM: ├ ├ /posts/rich-content-with-mdx
4:38:15 AM: ├ └ [+3 more paths]
4:38:15 AM: ├ ● /posts/page/[page] 1.36 kB 80.9 kB
4:38:15 AM: ├ └ /posts/page/2
4:38:15 AM: └ ● /posts/tags/[[...slug]] 1.32 kB 80.8 kB
4:38:15 AM: ├ /posts/tags/document
4:38:15 AM: ├ /posts/tags/mock
4:38:15 AM: ├ /posts/tags/style
4:38:15 AM: └ [+3 more paths]
4:38:15 AM: + First Load JS shared by all 63.8 kB
4:38:15 AM: ├ chunks/commons.5bc016.js 13.6 kB
4:38:15 AM: ├ chunks/framework.2d0daf.js 42.1 kB
4:38:15 AM: ├ chunks/main.0de564.js 6.8 kB
4:38:15 AM: ├ chunks/pages/_app.5168e8.js 581 B
4:38:15 AM: ├ chunks/webpack.50bee0.js 751 B
4:38:15 AM: └ css/7e37b93ade22ad15b8af.css 1.01 kB
4:38:15 AM: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
4:38:15 AM: ○ (Static) automatically rendered as static HTML (uses no initial props)
4:38:15 AM: ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
4:38:15 AM: (ISR) incremental static regeneration (uses revalidate in getStaticProps)
4:38:15 AM: info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
4:38:15 AM: info - using build directory: /opt/build/repo/.next
4:38:15 AM: info - Copying "static build" directory
4:38:15 AM: info - No "exportPathMap" found in "next.config.js". Generating map from "./pages"
4:38:15 AM: info - Launching 31 workers
4:38:15 AM: info - Exporting (0/3)
4:38:15 AM: info - Copying "public" directory
4:38:16 AM: info - Exporting (3/3)
4:38:16 AM: Export successful. Files written to /opt/build/repo/dist
4:38:17 AM: ​
4:38:17 AM: (build.command completed in 19s)
4:38:17 AM: ​
4:38:17 AM: ────────────────────────────────────────────────────────────────
4:38:17 AM: 3. @netlify/plugin-nextjs (onBuild event)
4:38:17 AM: ────────────────────────────────────────────────────────────────
4:38:17 AM: ​
4:38:17 AM: ​
4:38:17 AM: ────────────────────────────────────────────────────────────────
4:38:17 AM: Plugin "@netlify/plugin-nextjs" failed
4:38:17 AM: ────────────────────────────────────────────────────────────────
4:38:17 AM: ​
4:38:17 AM: Error message
4:38:17 AM: Error: The directory "/opt/build/repo/dist" does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
4:38:17 AM: However, a '.next' directory was found with a production build.
4:38:17 AM: Consider changing your 'publish' directory to '.next'
4:38:17 AM: If you are using "next export" then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to "true".
4:38:17 AM: ​
4:38:17 AM: Plugin details
4:38:17 AM: Package: @netlify/plugin-nextjs
4:38:17 AM: Version: 4.24.3
4:38:17 AM: Repository: git+https://github.com/netlify/next-runtime.git
4:38:17 AM: npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs
4:38:17 AM: Report issues: https://github.com/netlify/next-runtime/issues
4:38:17 AM: ​
4:38:17 AM: Error location
4:38:17 AM: In "onBuild" event in "@netlify/plugin-nextjs" from Netlify app
4:38:17 AM: ​
4:38:17 AM: Resolved config
4:38:17 AM: build:
4:38:17 AM: command: npm run export
4:38:17 AM: commandOrigin: config
4:38:17 AM: environment:
4:38:17 AM: - NEXT_PRIVATE_TARGET
4:38:17 AM: publish: /opt/build/repo/dist
4:38:17 AM: publishOrigin: config
4:38:17 AM: plugins:
4:38:17 AM: - inputs: {}
4:38:17 AM: origin: ui
4:38:17 AM: package: '@netlify/plugin-nextjs'
4:38:17 AM: Caching artifacts
4:38:17 AM: Started saving node modules
4:38:17 AM: Finished saving node modules
4:38:17 AM: Started saving build plugins
4:38:17 AM: Finished saving build plugins
4:38:17 AM: Started saving yarn cache
4:38:19 AM: Finished saving yarn cache
4:38:19 AM: Started saving pip cache
4:38:19 AM: Finished saving pip cache
4:38:19 AM: Started saving emacs cask dependencies
4:38:19 AM: Finished saving emacs cask dependencies
4:38:19 AM: Started saving maven dependencies
4:38:19 AM: Finished saving maven dependencies
4:38:19 AM: Started saving boot dependencies
4:38:19 AM: Finished saving boot dependencies
4:38:19 AM: Started saving rust rustup cache
4:38:19 AM: Finished saving rust rustup cache
4:38:19 AM: Started saving go dependencies
4:38:19 AM: Finished saving go dependencies
4:38:19 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:38:19 AM: Creating deploy upload records
4:38:19 AM: Failing build: Failed to build site
4:38:20 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:38:20 AM: Finished processing build request in 54.190804913s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions