It looks like there’s a problem with the caching mechanism in my builds as every build I run fails with the same error.
However when I click retry deploy → clear cache and deploy site it works 100%.
I do not use the essential nextjs plugin as the readme suggests not using it with next export.
here’s the first half of the deploy log of buildID: 62405aaf65b32000095db49e
2:38:07 PM: Build ready to start
2:38:11 PM: build-image version: 01acd77a1510fdb8f4fc9a04f21fc94be8fc1167 (xenial)
2:38:11 PM: build-image tag: v3.11.0
2:38:11 PM: buildbot version: 43c70c62bfed821cfaaabbb50f00238dd4bdd2d6
2:38:11 PM: Fetching cached dependencies
2:38:11 PM: Starting to download cache of 124.0MB
2:38:12 PM: Finished downloading cache in 1.359007023s
2:38:12 PM: Starting to extract cache
2:38:16 PM: Finished extracting cache in 3.933286473s
2:38:16 PM: Finished fetching cache in 5.310982201s
2:38:16 PM: Starting to prepare the repo for build
2:38:17 PM: Preparing Git Reference refs/heads/master
2:38:18 PM: Parsing package.json dependencies
2:38:19 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'apps/web' versus '/apps/web' in the Netlify UI
2:38:19 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'apps/web/out' versus 'out' in the Netlify UI
2:38:19 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'apps/web/functions' versus 'functions' in the Netlify UI
2:38:19 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'CI= npm run build && npm run export' versus 'next build' in the Netlify UI
2:38:20 PM: Starting build script
2:38:20 PM: Installing dependencies
2:38:20 PM: Python version set to 2.7
2:38:21 PM: Started restoring cached node version
2:38:23 PM: Finished restoring cached node version
2:38:24 PM: v16.14.2 is already installed.
2:38:25 PM: npm WARN ignoring workspace config at /opt/build/repo/apps/web/.npmrc
2:38:25 PM: npm WARN config This command does not support workspaces.
2:38:25 PM: Now using node v16.14.2 (npm v8.5.0)
2:38:25 PM: Started restoring cached build plugins
2:38:25 PM: Finished restoring cached build plugins
2:38:26 PM: Attempting ruby version 2.7.2, read from environment
2:38:28 PM: Using ruby version 2.7.2
2:38:28 PM: Using PHP version 5.6
2:38:28 PM: Started restoring cached node modules
2:38:28 PM: Finished restoring cached node modules
2:38:29 PM: npm WARN ignoring workspace config at /opt/build/repo/apps/web/.npmrc
2:38:29 PM: npm ERR! code ENOWORKSPACES
2:38:29 PM: npm ERR! This command does not support workspaces.
2:38:29 PM: npm ERR! A complete log of this run can be found in:
2:38:29 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-03-27T12_38_29_141Z-debug-0.log
2:38:29 PM: Started restoring cached go cache
2:38:29 PM: Finished restoring cached go cache
2:38:29 PM: go version go1.14.4 linux/amd64
2:38:29 PM: go version go1.14.4 linux/amd64
2:38:29 PM: Installing missing commands
2:38:29 PM: Verify run directory
2:38:31 PM:
2:38:31 PM: ────────────────────────────────────────────────────────────────
2:38:31 PM: Netlify Build
2:38:31 PM: ────────────────────────────────────────────────────────────────
2:38:31 PM:
2:38:31 PM: ❯ Version
2:38:31 PM: @netlify/build 26.5.1
2:38:31 PM:
2:38:31 PM: ❯ Flags
2:38:31 PM: baseRelDir: true
2:38:31 PM: buildId: 62405aaf65b32000095db49c
2:38:31 PM: deployId: 62405aaf65b32000095db49e
2:38:31 PM:
2:38:31 PM: ❯ Current directory
2:38:31 PM: /opt/build/repo/apps/web
2:38:31 PM:
2:38:31 PM: ❯ Config file
2:38:31 PM: /opt/build/repo/apps/web/netlify.toml
2:38:31 PM:
2:38:31 PM: ❯ Context
2:38:31 PM: production
2:38:31 PM:
2:38:31 PM: ❯ Loading plugins
2:38:31 PM: - @sentry/netlify-build-plugin@1.1.1 from netlify.toml
2:38:33 PM:
2:38:33 PM: ────────────────────────────────────────────────────────────────
2:38:33 PM: 1. build.command from netlify.toml
2:38:33 PM: ────────────────────────────────────────────────────────────────
2:38:33 PM:
2:38:33 PM: $ CI= npm run build && npm run export
2:38:34 PM: npm WARN ignoring workspace config at /opt/build/repo/apps/web/.npmrc
2:38:34 PM: > web@0.1.0 build
2:38:34 PM: > next build
2:38:34 PM: sh: 1: next: not found
2:38:34 PM: npm ERR! Lifecycle script `build` failed with error:
2:38:34 PM: npm ERR! Error: command failed
2:38:34 PM: npm ERR! in workspace: web@0.1.0
2:38:34 PM: npm ERR! at location: /opt/build/repo/apps/web
2:38:34 PM:
2:38:34 PM: ────────────────────────────────────────────────────────────────
2:38:34 PM: "build.command" failed
2:38:34 PM: ────────────────────────────────────────────────────────────────
2:38:34 PM:
2:38:34 PM: Error message
2:38:34 PM: Command failed with exit code 1: CI= npm run build && npm run export (https://ntl.fyi/exit-code-1)
2:38:34 PM:
2:38:34 PM: Error location
2:38:34 PM: In build.command from netlify.toml:
2:38:34 PM: CI= npm run build && npm run export
Here’s my netlify.toml
[build]
functions = "functions"
command = "CI= npm run build && npm run export"
publish = "out"
[build.environment]
NETLIFY_NEXT_PLUGIN_SKIP = "true"
NODE_VERSION = "16"
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/:splat"
status = 200
[functions]
node_bundler = "esbuild"
directory = "functions/"
external_node_modules = ["firebase-admin", "node-fetch", "cookie", "discord.js", "axios"]
[functions."triggerAutomations"]
schedule = "@hourly"
[[plugins]]
package = "@sentry/netlify-build-plugin"
[plugins.inputs]
sentryOrg = "org"
sentryProject = "project"