Skip to content

Build fail when deploying to Netlify #51

@christophejourdan

Description

@christophejourdan

I only clicked on the button in the readme that says Deploy on Netlify.
It created the repo in Github but then the build fails with this error:

10:57:16 AM: build-image version: 3ffff9df3d5419545acc1b673a54de348174406d (focal)
10:57:16 AM: buildbot version: d87b55aad19e546266bee69776544e7982adf445
10:57:16 AM: Fetching cached dependencies
10:57:16 AM: Failed to fetch cache, continuing with build
10:57:16 AM: Starting to prepare the repo for build
10:57:17 AM: No cached dependencies found. Cloning fresh repo
10:57:17 AM: git clone --filter=blob:none https://github.com/wutali/nextjs-netlify-blog-template
10:57:17 AM: Preparing Git Reference refs/heads/master
10:57:19 AM: Starting to install dependencies
10:57:19 AM: Python version set to 3.8
10:57:19 AM: Attempting Ruby version 2.7.2, read from environment
10:57:20 AM: Using Ruby version 2.7.2
10:57:20 AM: Started restoring cached go cache
10:57:20 AM: Finished restoring cached go cache
10:57:22 AM: go version go1.19.13 linux/amd64
10:57:22 AM: Using PHP version 8.0
10:57:23 AM: Downloading and installing node v18.19.0...
10:57:23 AM: Downloading https://nodejs.org/dist/v18.19.0/node-v18.19.0-linux-x64.tar.xz...
10:57:24 AM: Computing checksum with sha256sum
10:57:24 AM: Checksums matched!
10:57:26 AM: Now using node v18.19.0 (npm v10.2.3)
10:57:26 AM: Enabling Node.js Corepack
10:57:26 AM: Started restoring cached build plugins
10:57:26 AM: Finished restoring cached build plugins
10:57:26 AM: Started restoring cached corepack dependencies
10:57:26 AM: Finished restoring cached corepack dependencies
10:57:26 AM: Started restoring cached yarn cache
10:57:26 AM: Finished restoring cached yarn cache
10:57:27 AM: No yarn workspaces detected
10:57:27 AM: Started restoring cached node modules
10:57:27 AM: Finished restoring cached node modules
10:57:27 AM: Installing npm packages using Yarn version 1.22.19
10:57:27 AM: yarn install v1.22.19
10:57:27 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.
10:57:27 AM: [1/4] Resolving packages...
10:57:28 AM: [2/4] Fetching packages...
10:57:36 AM: [3/4] Linking dependencies...
10:57:36 AM: warning " > [email protected]" has incorrect peer dependency "react@>=16.13.1 <=17.0.1".
10:57:36 AM: warning " > [email protected]" has incorrect peer dependency "react-dom@>=16.13.1 <=17.0.1".
10:57:36 AM: warning " > [email protected]" has incorrect peer dependency "react@^16.0.0 || ^15.0.0 || ~0.14.0".
10:57:36 AM: warning " > [email protected]" has incorrect peer dependency "react-dom@^16.0.0 || ^15.0.0 || ~0.14.0".
10:57:36 AM: warning " > [email protected]" has unmet peer dependency "prop-types@^15.5.4".
10:57:36 AM: warning " > [email protected]" has incorrect peer dependency "react@^15.0.0 || ^16.0.0".
10:57:36 AM: warning " > [email protected]" has incorrect peer dependency "react-dom@^15.0.0 || ^16.0.0".
10:57:36 AM: warning "react-twitter-embed > [email protected]" has unmet peer dependency "enzyme@^3.0.0".
10:57:36 AM: warning "react-twitter-embed > [email protected]" has incorrect peer dependency "react@^16.0.0-0".
10:57:36 AM: warning "react-twitter-embed > [email protected]" has incorrect peer dependency "react-dom@^16.0.0-0".
10:57:36 AM: warning "react-twitter-embed > enzyme-adapter-react-16 > [email protected]" has incorrect peer dependency "[email protected] || 0.14.x || ^15.0.0-0 || ^16.0.0-0".
10:57:36 AM: warning "react-twitter-embed > enzyme-adapter-react-16 > [email protected]" has incorrect peer dependency "react@^16.14.0".
10:57:36 AM: warning "react-twitter-embed > enzyme-adapter-react-16 > enzyme-adapter-utils > [email protected]" has incorrect peer dependency "react@^0.14 || ^15.0.0 || ^16.0.0-alpha".
10:57:40 AM: [4/4] Building fresh packages...
10:57:40 AM: success Saved lockfile.
10:57:40 AM: Done in 12.49s.
10:57:40 AM: npm packages installed using Yarn
10:57:40 AM: Successfully installed dependencies
10:57:40 AM: Starting build script
10:57:41 AM: Detected 1 framework(s)
10:57:41 AM: "next" at version "10.1.2"
10:57:41 AM: Section completed: initializing
10:57:43 AM: ​
10:57:43 AM: Netlify Build                                                 
10:57:43 AM: ────────────────────────────────────────────────────────────────
10:57:43 AM: ​
10:57:43 AM: ❯ Version
10:57:43 AM:   @netlify/build 29.29.4
10:57:43 AM: ​
10:57:43 AM: ❯ Flags
10:57:43 AM:   baseRelDir: true
10:57:43 AM:   buildId: 6569f44b05d6ec0087dfe795
10:57:43 AM:   deployId: 6569f44b05d6ec0087dfe797
10:57:43 AM: ​
10:57:43 AM: ❯ Current directory
10:57:43 AM:   /opt/build/repo
10:57:43 AM: ​
10:57:43 AM: ❯ Config file
10:57:43 AM:   /opt/build/repo/netlify.toml
10:57:43 AM: ​
10:57:43 AM: ❯ Context
10:57:43 AM:   production
10:57:43 AM: ​
10:57:43 AM: build.command from netlify.toml                               
10:57:43 AM: ────────────────────────────────────────────────────────────────
10:57:43 AM: ​
10:57:43 AM: $ npm run export
10:57:44 AM: > [email protected] export
10:57:44 AM: > next build && next export -o ./dist
10:57:44 AM: Browserslist: caniuse-lite is outdated. Please run:
10:57:44 AM: npx browserslist@latest --update-db
10:57:44 AM: Why you should do it regularly:
10:57:44 AM: https://github.com/browserslist/browserslist#browsers-data-updating
10:57:44 AM: node:internal/errors:496
10:57:44 AM:     ErrorCaptureStackTrace(err);
10:57:44 AM:     ^
10:57:44 AM: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath "./lib/parser" is not defined by "exports" in /opt/build/repo/node_modules/next/node_modules/postcss/package.json
10:57:44 AM:     at new NodeError (node:internal/errors:405:5)
10:57:44 AM:     at exportsNotFound (node:internal/modules/esm/resolve:366:10)
10:57:44 AM:     at packageExportsResolve (node:internal/modules/esm/resolve:713:9)
10:57:44 AM:     at resolveExports (node:internal/modules/cjs/loader:584:36)
10:57:44 AM:     at Module._findPath (node:internal/modules/cjs/loader:658:31)
10:57:44 AM:     at Module._resolveFilename (node:internal/modules/cjs/loader:1120:27)
10:57:44 AM:     at Module._load (node:internal/modules/cjs/loader:975:27)
10:57:44 AM:     at Module.require (node:internal/modules/cjs/loader:1225:19)
10:57:44 AM:     at require (node:internal/modules/helpers:177:18)
10:57:44 AM:     at 552 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11590)
10:57:44 AM:     at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
10:57:44 AM:     at 270 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:400)
10:57:44 AM:     at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
10:57:44 AM:     at 327 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:260)
10:57:44 AM:     at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
10:57:44 AM:     at 845 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:3733) {
10:57:44 AM:   code: "ERR_PACKAGE_PATH_NOT_EXPORTED"
10:57:44 AM: }
10:57:44 AM: Node.js v18.19.0
10:57:44 AM: ​
10:57:44 AM: "build.command" failed                                        
10:57:44 AM: ────────────────────────────────────────────────────────────────
10:57:44 AM: ​
10:57:44 AM:   Error message
10:57:44 AM:   Command failed with exit code 1: npm run export (https://ntl.fyi/exit-code-1)
10:57:44 AM: ​
10:57:44 AM:   Error location
10:57:44 AM:   In build.command from netlify.toml:
10:57:44 AM:   npm run export
10:57:44 AM: ​
10:57:44 AM:   Resolved config
10:57:44 AM:   build:
10:57:44 AM:     command: npm run export
10:57:44 AM:     commandOrigin: config
10:57:44 AM:     publish: /opt/build/repo/dist
10:57:44 AM:     publishOrigin: config
10:57:44 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:57:45 AM: Failed during stage "building site": Build script returned non-zero exit code: 2
10:57:45 AM: Failing build: Failed to build site
10:57:45 AM: Finished processing build request in 28.65s

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