Failed during stage ‘building site’: Build script returned non-zero exit code: 2
Hello I have the error of the titlte when I’m trying to deploy my site, I get an error when try to build.
Locally I can compile and buil with no problem
I don’t know if I have to install a netlify package or add some configuration to my code
This is the log
11:10:28 AM: build-image version: 20e1f1f500e4cbad9ea8a99bd40807bef3093551 (focal)
11:10:28 AM: buildbot version: 77071362d8e2c4892a900c59914f4f5b20867e29
11:10:28 AM: Fetching cached dependencies
11:10:28 AM: Failed to fetch cache, continuing with build
11:10:28 AM: Starting to prepare the repo for build
11:10:28 AM: No cached dependencies found. Cloning fresh repo
11:10:28 AM: git clone --filter=blob:none GitHub - matiasvidela96/Financial-Education
11:10:28 AM: Preparing Git Reference refs/heads/master
11:10:30 AM: Starting to install dependencies
11:10:30 AM: Python version set to 3.8
11:10:30 AM: Attempting Ruby version 2.7.2, read from environment
11:10:31 AM: Using Ruby version 2.7.2
11:10:31 AM: Started restoring cached go cache
11:10:31 AM: Finished restoring cached go cache
11:10:32 AM: Installing Go version 1.19.12 (requested 1.19.x)
11:10:37 AM: go version go1.19.12 linux/amd64
11:10:37 AM: Using PHP version 8.0
11:10:38 AM: v18.17.0 is already installed.
11:10:39 AM: Now using node v18.17.0 (npm v9.6.7)
11:10:39 AM: Enabling Node.js Corepack
11:10:39 AM: Started restoring cached build plugins
11:10:39 AM: Finished restoring cached build plugins
11:10:39 AM: Started restoring cached corepack dependencies
11:10:39 AM: Finished restoring cached corepack dependencies
11:10:39 AM: No npm workspaces detected
11:10:39 AM: Started restoring cached node modules
11:10:39 AM: Finished restoring cached node modules
11:10:39 AM: Installing npm packages using npm version 9.6.7
11:10:44 AM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic.
11:10:44 AM: npm WARN deprecated request-promise@4.2.2: request-promise has been deprecated because it extends the now deprecated request package,
11:10:44 AM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
11:10:44 AM: npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
11:10:45 AM: npm WARN deprecated babyparse@0.4.6: Deprecated in favour of PapaParse, which now supports Node.js
11:10:45 AM: npm WARN deprecated bson@0.4.23: Fixed a critical issue with BSON serialization documented in CVE-2019-2391
11:10:46 AM: npm WARN deprecated core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
11:10:59 AM: added 528 packages, and audited 529 packages in 19s
11:10:59 AM: 57 packages are looking for funding
11:10:59 AM: run npm fund
for details
11:10:59 AM: 17 vulnerabilities (8 moderate, 5 high, 4 critical)
11:10:59 AM: To address issues that do not require attention, run:
11:10:59 AM: npm audit fix
11:10:59 AM: Some issues need review, and may require choosing
11:10:59 AM: a different dependency.
11:10:59 AM: Run npm audit
for details.
11:10:59 AM: npm packages installed
11:10:59 AM: Install dependencies script success
11:10:59 AM: Starting build script
11:11:00 AM: Detected 1 framework(s)
11:11:00 AM: next at version 13.4.4
11:11:00 AM: Section completed: initializing
11:11:02 AM:
11:11:02 AM: Netlify Build
11:11:02 AM: ────────────────────────────────────────────────────────────────
11:11:02 AM:
11:11:02 AM: ❯ Version
11:11:02 AM: @netlify/build 29.17.4
11:11:02 AM:
11:11:02 AM: ❯ Flags
11:11:02 AM: baseRelDir: true
11:11:02 AM: buildId: 64ce584ef1f1824387e8a94e
11:11:02 AM: deployId: 64ce584ef1f1824387e8a950
11:11:02 AM:
11:11:02 AM: ❯ Current directory
11:11:02 AM: /opt/build/repo
11:11:02 AM:
11:11:02 AM: ❯ Config file
11:11:02 AM: No config file was defined: using default values.
11:11:02 AM:
11:11:02 AM: ❯ Context
11:11:02 AM: production
11:11:02 AM:
11:11:02 AM: ❯ Using Next.js Runtime - v4.39.3
11:11:03 AM:
11:11:03 AM: @netlify/plugin-nextjs (onPreBuild event)
11:11:03 AM: ────────────────────────────────────────────────────────────────
11:11:03 AM:
11:11:03 AM: No Next.js cache to restore.
11:11:03 AM: Not running Next Runtime
11:11:03 AM:
11:11:03 AM: (@netlify/plugin-nextjs onPreBuild completed in 8ms)
11:11:03 AM:
11:11:03 AM: Build command from Netlify app
11:11:03 AM: ────────────────────────────────────────────────────────────────
11:11:03 AM:
11:11:03 AM: $ npm run build
11:11:03 AM: > open-pro-next@0.1.0 build
11:11:03 AM: > next build
11:11:03 AM: - info Loaded env from /opt/build/repo/.env
11:11:03 AM: - warn No build cache found. Please configure build caching for faster rebuilds.
11:11:03 AM: - info Creating an optimized production build…
11:11:26 AM: - warn Compiled with warnings
11:11:26 AM: ./node_modules/cross-fetch/node_modules/node-fetch/lib/index.js
11:11:26 AM: Module not found: Can’t resolve ‘encoding’ in ‘/opt/build/repo/node_modules/cross-fetch/node_modules/node-fetch/lib’
11:11:26 AM: Import trace for requested module:
11:11:26 AM: ./node_modules/cross-fetch/node_modules/node-fetch/lib/index.js
11:11:26 AM: ./node_modules/cross-fetch/dist/node-ponyfill.js
11:11:26 AM: ./node_modules/alphavantage/dist/bundle.js
11:11:26 AM: ./app/api/noticias/route.ts
11:11:26 AM: - info Linting and checking validity of types…
11:11:30 AM: - info Collecting page data…
11:11:43 AM: - info Generating static pages (0/20)
11:11:43 AM: - info Generating static pages (5/20)
11:11:44 AM: - info Generating static pages (10/20)
11:11:44 AM: - info Generating static pages (15/20)
11:11:44 AM: - info Generating static pages (20/20)
11:11:44 AM: - info Finalizing page optimization…
11:11:44 AM: Route (app) Size First Load JS
11:11:44 AM: ┌ ○ / 0 B 0 B
11:11:44 AM: ├ ○ /academy 2.56 kB 989 kB
11:11:44 AM: ├ ○ /academy/bolsa 1.71 kB 983 kB
11:11:44 AM: ├ ○ /academy/bolsa/plazoFijo 2.38 kB 85.3 kB
11:11:44 AM: ├ ○ /academy/crypto 1.63 kB 983 kB
11:11:44 AM: ├ λ /api/chat 0 B 0 B
11:11:44 AM: ├ ○ /api/hello 0 B 0 B
11:11:44 AM: ├ ○ /api/noticias 0 B 0 B
11:11:44 AM: ├ ○ /calculadora 148 B 77.4 kB
11:11:44 AM: ├ ○ /chatSeccion 7 kB 84.3 kB
11:11:44 AM: ├ ○ /comparador 148 B 77.4 kB
11:11:44 AM: ├ ○ /misEstrategias 148 B 77.4 kB
11:11:44 AM: ├ ○ /noticias 1.97 kB 84.9 kB
11:11:44 AM: ├ ○ /perfilInversor 2.32 kB 79.6 kB
11:11:44 AM: ├ ○ /reset-password 0 B 0 B
11:11:44 AM: ├ ○ /signin 0 B 0 B
11:11:44 AM: ├ ○ /signup 0 B 0 B
11:11:44 AM: └ ○ /startPage 1.25 kB 983 kB
11:11:44 AM: + First Load JS shared by all 77.3 kB
11:11:44 AM: ├ chunks/2443530c-b2ac1ed2613c4a19.js 50.5 kB
11:11:44 AM: ├ chunks/488-e662ec6a5d2085c9.js 24.7 kB
11:11:44 AM: ├ chunks/main-app-60bfd79544e207f2.js 214 B
11:11:44 AM: └ chunks/webpack-b48849b26dcf4ff1.js 1.81 kB
11:11:44 AM: Route (pages) Size First Load JS
11:11:44 AM: ─ ○ /404 181 B 74.9 kB
11:11:44 AM: + First Load JS shared by all 74.8 kB
11:11:44 AM: ├ chunks/framework-8883d1e9be70c3da.js 45.1 kB
11:11:44 AM: ├ chunks/main-2ad28f552a3e8a0f.js 27.7 kB
11:11:44 AM: ├ chunks/pages/_app-b555d5e1eab47959.js 195 B
11:11:44 AM: └ chunks/webpack-b48849b26dcf4ff1.js 1.81 kB
11:11:44 AM: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
11:11:44 AM: ○ (Static) automatically rendered as static HTML (uses no initial props)
11:11:44 AM:
11:11:44 AM: (build.command completed in 41.6s)
11:11:44 AM:
11:11:44 AM: @netlify/plugin-nextjs (onBuild event)
11:11:44 AM: ────────────────────────────────────────────────────────────────
11:11:44 AM:
11:11:44 AM:
11:11:44 AM: (@netlify/plugin-nextjs onBuild completed in 4ms)
11:11:45 AM:
11:11:45 AM: @netlify/plugin-nextjs (onPostBuild event)
11:11:45 AM: ────────────────────────────────────────────────────────────────
11:11:45 AM:
11:11:45 AM: Next.js cache saved.
11:11:45 AM:
11:11:45 AM: (@netlify/plugin-nextjs onPostBuild completed in 313ms)
11:11:45 AM:
11:11:45 AM: Deploy site
11:11:45 AM: ────────────────────────────────────────────────────────────────
11:11:45 AM:
11:11:45 AM: Section completed: deploying
11:11:45 AM:
11:11:45 AM: Configuration error
11:11:45 AM: ────────────────────────────────────────────────────────────────
11:11:45 AM:
11:11:45 AM: Error message
11:11:45 AM: Deploy did not succeed: Deploy directory ‘dist’ does not exist
11:11:45 AM:
11:11:45 AM: Resolved config
11:11:45 AM: build:
11:11:45 AM: command: npm run build
11:11:45 AM: commandOrigin: ui
11:11:45 AM: environment:
11:11:45 AM: - DEPRECATED
11:11:45 AM: - NETLIFY_NEXT_PLUGIN_SKIP
11:11:45 AM: publish: /opt/build/repo/dist
11:11:45 AM: publishOrigin: ui
11:11:45 AM: plugins:
11:11:45 AM: - inputs: {}
11:11:45 AM: origin: ui
11:11:45 AM: package: ‘@netlify/plugin-nextjs’
11:11:46 AM: Caching artifacts
11:11:46 AM: Started saving node modules
11:11:46 AM: Finished saving node modules
11:11:46 AM: Started saving build plugins
11:11:46 AM: Finished saving build plugins
11:11:46 AM: Started saving corepack cache
11:11:46 AM: Finished saving corepack cache
11:11:46 AM: Started saving pip cache
11:11:46 AM: Finished saving pip cache
11:11:46 AM: Started saving emacs cask dependencies
11:11:46 AM: Finished saving emacs cask dependencies
11:11:46 AM: Started saving maven dependencies
11:11:46 AM: Finished saving maven dependencies
11:11:46 AM: Started saving boot dependencies
11:11:46 AM: Finished saving boot dependencies
11:11:46 AM: Started saving rust rustup cache
11:11:46 AM: Finished saving rust rustup cache
11:11:46 AM: Started saving go dependencies
11:11:46 AM: Finished saving go dependencies
11:11:47 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
11:11:46 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:11:46 AM: Failing build: Failed to build site
11:11:47 AM: Finished processing build request in 1m19.342s