Site name is huihui-restaurant.
I’ve been facing build problems in Netlify despite the site working locally just fine. I’ve been getting non-exit codes 1 & 2.
First, Plugin “@netlify/plugin-nextjs” failed. I updated the plugin.
Then, opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ]. I added "NODE_OPTIONS=‘–openssl-legacy-provider’ in the build command, then removed it since I was still getting the same errors.
Then, I updated my next dependency from 10.0.0 to 10.0.6.
Now I’m not getting the plugin error or digital envelope error. I’m getting a stack trace error. I’m pasting the build log below.
I also added some environment variables per recommendations from other forum threads I’ve been reading. I’m unsure if I need them. They are NPM_FLAGS and the NETLIFY_NEXT_PLUGIN_SKIP variables.
4:15:58 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:15:28 PM: build-image version: ad28fb91fae632ef7f2e4d659a892d68ee2681a6 (focal)
4:15:28 PM: buildbot version: a00c3a106ad0a66dd4bc30c43ab769447ea2db3e
4:15:28 PM: Building without cache
4:15:28 PM: Starting to prepare the repo for build
4:15:28 PM: No cached dependencies found. Cloning fresh repo
4:15:28 PM: git clone --filter=blob:none https://github.com/sdghi/huihui
4:15:29 PM: Preparing Git Reference refs/heads/main
4:15:31 PM: Starting to install dependencies
4:15:31 PM: Python version set to 3.8
4:15:31 PM: Attempting Ruby version 2.7.2, read from environment
4:15:31 PM: Using Ruby version 2.7.2
4:15:32 PM: Started restoring cached go cache
4:15:32 PM: Finished restoring cached go cache
4:15:32 PM: go version go1.19.11 linux/amd64
4:15:32 PM: Using PHP version 8.0
4:15:33 PM: v18.17.0 is already installed.
4:15:34 PM: Now using node v18.17.0 (npm v9.6.7)
4:15:34 PM: Enabling Node.js Corepack
4:15:34 PM: Started restoring cached build plugins
4:15:34 PM: Finished restoring cached build plugins
4:15:34 PM: Started restoring cached corepack dependencies
4:15:34 PM: Finished restoring cached corepack dependencies
4:15:34 PM: Started restoring cached yarn cache
4:15:34 PM: Finished restoring cached yarn cache
4:15:34 PM: No yarn workspaces detected
4:15:34 PM: Started restoring cached node modules
4:15:34 PM: Finished restoring cached node modules
4:15:34 PM: Installing npm packages using Yarn version 1.22.19
4:15:35 PM: yarn install v1.22.19
4:15:35 PM: warning package.json: No license field
4:15:35 PM: 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:15:35 PM: warning project-starter@0.1.0: No license field
4:15:35 PM: [1/4] Resolving packages...
4:15:35 PM: [2/4] Fetching packages...
4:15:42 PM: [3/4] Linking dependencies...
4:15:42 PM: warning > flex-gap-polyfill@2.2.1 has unmet peer dependency postcss@^8.2.4.
4:15:42 PM: warning > postcss-flexbugs-fixes@5.0.2 has unmet peer dependency postcss@^8.1.4.
4:15:46 PM: [4/4] Building fresh packages...
4:15:49 PM: Done in 14.75s.
4:15:49 PM: npm packages installed using Yarn
4:15:50 PM: Install dependencies script success
4:15:50 PM: Starting build script
4:15:51 PM: Detected 1 framework(s)
4:15:51 PM: next at version 10.0.6
4:15:51 PM: Section completed: initializing
4:15:53 PM:
4:15:53 PM: Netlify Build
4:15:53 PM: ────────────────────────────────────────────────────────────────
4:15:53 PM:
4:15:53 PM: ❯ Version
4:15:53 PM: @netlify/build 29.17.1
4:15:53 PM:
4:15:53 PM: ❯ Flags
4:15:53 PM: baseRelDir: true
4:15:53 PM: buildId: 64b9ea3ec3c0522573f7521c
4:15:53 PM: deployId: 64b9ea3ec3c0522573f7521e
4:15:53 PM:
4:15:53 PM: ❯ Current directory
4:15:53 PM: /opt/build/repo
4:15:53 PM:
4:15:53 PM: ❯ Config file
4:15:53 PM: /opt/build/repo/netlify.toml
4:15:53 PM:
4:15:53 PM: ❯ Context
4:15:53 PM: production
4:15:53 PM:
4:15:53 PM: ❯ Using Next.js Runtime - v3.9.2
4:15:53 PM:
4:15:53 PM: ❯ Outdated plugins
4:15:53 PM: - @netlify/plugin-nextjs@3.9.2: latest version is 4.39.1
4:15:53 PM: To upgrade this plugin, please update its version in package.json
4:15:54 PM:
4:15:54 PM: @netlify/plugin-nextjs (onPreBuild event)
4:15:54 PM: ────────────────────────────────────────────────────────────────
4:15:54 PM:
4:15:54 PM: Using Next.js 10.0.6
4:15:54 PM: NOTE: Static HTML export Next.js projects (projects that use `next export`) do not require most of this plugin. For these sites, this plugin *only* caches builds.
4:15:54 PM:
4:15:54 PM: (@netlify/plugin-nextjs onPreBuild completed in 10ms)
4:15:54 PM:
4:15:54 PM: Build command from Netlify app
4:15:54 PM: ────────────────────────────────────────────────────────────────
4:15:54 PM:
4:15:54 PM: $ yarn build
4:15:54 PM: yarn run v1.22.19
4:15:54 PM: warning package.json: No license field
4:15:54 PM: $ next build && next export
4:15:55 PM: node:internal/errors:496
4:15:55 PM: ErrorCaptureStackTrace(err);
4:15:55 PM: ^
4:15:55 PM: 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
4:15:55 PM: at new NodeError (node:internal/errors:405:5)
4:15:55 PM: at exportsNotFound (node:internal/modules/esm/resolve:359:10)
4:15:55 PM: at packageExportsResolve (node:internal/modules/esm/resolve:695:9)
4:15:55 PM: at resolveExports (node:internal/modules/cjs/loader:567:36)
4:15:55 PM: at Module._findPath (node:internal/modules/cjs/loader:636:31)
4:15:55 PM: at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
4:15:55 PM: at Module._load (node:internal/modules/cjs/loader:922:27)
4:15:55 PM: at Module.require (node:internal/modules/cjs/loader:1143:19)
4:15:55 PM: at require (node:internal/modules/cjs/helpers:110:18)
4:15:55 PM: at 552 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11590)
4:15:55 PM: at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
4:15:55 PM: at 270 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:400)
4:15:55 PM: at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
4:15:55 PM: at 327 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:260)
4:15:55 PM: at __nccwpck_require__ (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
4:15:55 PM: at 845 (/opt/build/repo/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:3733) {
4:15:55 PM: code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
4:15:55 PM: }
4:15:55 PM: Node.js v18.17.0
4:15:55 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
4:15:55 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
4:15:55 PM:
4:15:55 PM: build.command failed
4:15:55 PM: ────────────────────────────────────────────────────────────────
4:15:55 PM:
4:15:55 PM: Error message
4:15:55 PM: Command failed with exit code 1: yarn build (https://ntl.fyi/exit-code-1)
4:15:55 PM:
4:15:55 PM: Error location
4:15:55 PM: In Build command from Netlify app:
4:15:55 PM: yarn build
4:15:55 PM:
4:15:55 PM: Resolved config
4:15:55 PM: build:
4:15:55 PM: command: yarn build
4:15:55 PM: commandOrigin: ui
4:15:55 PM: environment:
4:15:55 PM: - NETLIFY_NEXT_PLUGIN_SKIP
4:15:55 PM: - NEXT_PUBLIC_GOOGLE_ANALYTICS
4:15:55 PM: - NEXT_PUBLIC_PRISMIC_ACCESS_TOKEN
4:15:55 PM: - NEXT_PUBLIC_PRISMIC_ENDPOINT
4:15:55 PM: - NPM_FLAGS
4:15:55 PM: publish: /opt/build/repo/out
4:15:55 PM: publishOrigin: ui
4:15:55 PM: plugins:
4:15:55 PM: - inputs: {}
4:15:55 PM: origin: ui
4:15:55 PM: package: '@netlify/plugin-nextjs'
4:15:56 PM: Caching artifacts
4:15:56 PM: Started saving node modules
4:15:56 PM: Finished saving node modules
4:15:56 PM: Started saving build plugins
4:15:56 PM: Finished saving build plugins
4:15:56 PM: Started saving corepack cache
4:15:56 PM: Finished saving corepack cache
4:15:56 PM: Started saving yarn cache
4:15:57 PM: Finished saving yarn cache
4:15:57 PM: Started saving pip cache
4:15:57 PM: Finished saving pip cache
4:15:57 PM: Started saving emacs cask dependencies
4:15:57 PM: Finished saving emacs cask dependencies
4:15:57 PM: Started saving maven dependencies
4:15:57 PM: Finished saving maven dependencies
4:15:57 PM: Started saving boot dependencies
4:15:57 PM: Finished saving boot dependencies
4:15:57 PM: Started saving rust rustup cache
4:15:57 PM: Finished saving rust rustup cache
4:15:57 PM: Started saving go dependencies
4:15:57 PM: Finished saving go dependencies
4:15:58 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:15:58 PM: Failing build: Failed to build site
4:15:59 PM: Finished processing build request in 30.517s
Sorry for the long story. I’m a not very experienced and trying to maintain sites that another dev built. I don’t think I have the hang of understanding these error logs yet.
Thank you.