Me and another dev have been trying to deploy a React site for several hours without success to both Vercel and Netlify. I came across this article on the CL build configuration but it didn’t work for me: New CI=true build configuration, "Treating warnings as errors because process.env.CI = true"
Site: https://graceful-seahorse-27949f.netlify.app/
Build Settings:
Log:
9:46:55 PM: Build ready to start
9:46:57 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
9:46:57 PM: build-image tag: v4.10.1
9:46:57 PM: buildbot version: fe6512288e75c8fa5aadaebb51ed1f96e9314fd4
9:46:57 PM: Building without cache
9:46:57 PM: Starting to prepare the repo for build
9:46:57 PM: No cached dependencies found. Cloning fresh repo
9:46:57 PM: git clone https://github.com/kevinorin/pl-coupons-react2.0
9:46:58 PM: Preparing Git Reference refs/heads/main
9:46:58 PM: Parsing package.json dependencies
9:46:59 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
9:46:59 PM: Starting build script
9:46:59 PM: Installing dependencies
9:46:59 PM: Python version set to 2.7
9:46:59 PM: v16.16.0 is already installed.
9:47:00 PM: Now using node v16.16.0 (npm v8.11.0)
9:47:00 PM: Started restoring cached build plugins
9:47:00 PM: Finished restoring cached build plugins
9:47:00 PM: Attempting ruby version 2.7.2, read from environment
9:47:00 PM: Using ruby version 2.7.2
9:47:01 PM: Using PHP version 8.0
9:47:01 PM: Started restoring cached yarn cache
9:47:01 PM: Finished restoring cached yarn cache
9:47:01 PM: No yarn workspaces detected
9:47:01 PM: Started restoring cached node modules
9:47:01 PM: Finished restoring cached node modules
9:47:01 PM: Installing NPM modules using Yarn version 1.22.10
9:47:01 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
9:47:01 PM: npm WARN config location in the cache, and they are managed by
9:47:01 PM: npm WARN config [`cacache`](http://npm.im/cacache).
9:47:01 PM: yarn install v1.22.10
9:47:02 PM: [1/4] Resolving packages...
9:47:02 PM: [2/4] Fetching packages...
9:47:19 PM: info @next/swc-android-arm64@12.1.0: The platform "linux" is incompatible with this module.
9:47:19 PM: info "@next/swc-android-arm64@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-android-arm64@12.1.0: The CPU architecture "x64" is incompatible with this module.
9:47:19 PM: info @next/swc-darwin-arm64@12.1.0: The platform "linux" is incompatible with this module.
9:47:19 PM: info "@next/swc-darwin-arm64@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-darwin-arm64@12.1.0: The CPU architecture "x64" is incompatible with this module.
9:47:19 PM: info @next/swc-darwin-x64@12.1.0: The platform "linux" is incompatible with this module.
9:47:19 PM: info "@next/swc-darwin-x64@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-linux-arm-gnueabihf@12.1.0: The CPU architecture "x64" is incompatible with this module.
9:47:19 PM: info "@next/swc-linux-arm-gnueabihf@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-linux-arm64-gnu@12.1.0: The CPU architecture "x64" is incompatible with this module.
9:47:19 PM: info "@next/swc-linux-arm64-gnu@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-linux-arm64-musl@12.1.0: The CPU architecture "x64" is incompatible with this module.
9:47:19 PM: info "@next/swc-linux-arm64-musl@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-win32-arm64-msvc@12.1.0: The platform "linux" is incompatible with this module.
9:47:19 PM: info "@next/swc-win32-arm64-msvc@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-win32-arm64-msvc@12.1.0: The CPU architecture "x64" is incompatible with this module.
9:47:19 PM: info @next/swc-win32-ia32-msvc@12.1.0: The platform "linux" is incompatible with this module.
9:47:19 PM: info "@next/swc-win32-ia32-msvc@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info @next/swc-win32-ia32-msvc@12.1.0: The CPU architecture "x64" is incompatible with this module.
9:47:19 PM: info @next/swc-win32-x64-msvc@12.1.0: The platform "linux" is incompatible with this module.
9:47:19 PM: info "@next/swc-win32-x64-msvc@12.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
9:47:19 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
9:47:19 PM: [3/4] Linking dependencies...
9:47:19 PM: warning "@emotion/react > @emotion/babel-plugin@11.10.0" has unmet peer dependency "@babel/core@^7.0.0".
9:47:19 PM: warning "@emotion/react > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.18.6" has unmet peer dependency "@babel/core@^7.0.0-0".
9:47:19 PM: warning " > @mui/x-date-pickers@5.0.0-beta.4" has unmet peer dependency "@mui/system@^5.4.1".
9:47:19 PM: warning " > formik-mui@4.0.0" has unmet peer dependency "tiny-warning@>=1.0.3".
9:47:19 PM: warning " > formik-mui-lab@1.0.0" has unmet peer dependency "tiny-warning@>=1.0.3".
9:47:19 PM: warning "recharts > react-smooth@2.0.1" has unmet peer dependency "prop-types@^15.6.0".
9:47:33 PM: [4/4] Building fresh packages...
9:47:33 PM: Done in 31.90s.
9:47:33 PM: NPM modules installed using Yarn
9:47:34 PM: Started restoring cached go cache
9:47:34 PM: Finished restoring cached go cache
9:47:34 PM: Installing Go version 1.17 (requested 1.17)
9:47:38 PM: unset GOOS;
9:47:38 PM: unset GOARCH;
9:47:38 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
9:47:38 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
9:47:38 PM: go version >&2;
9:47:38 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
9:47:38 PM: go version go1.17 linux/amd64
9:47:38 PM: Installing missing commands
9:47:38 PM: Verify run directory
9:47:39 PM:
9:47:39 PM: ────────────────────────────────────────────────────────────────
9:47:39 PM: Netlify Build
9:47:39 PM: ────────────────────────────────────────────────────────────────
9:47:39 PM:
9:47:39 PM: ❯ Version
9:47:39 PM: @netlify/build 27.9.1
9:47:39 PM:
9:47:39 PM: ❯ Flags
9:47:39 PM: baseRelDir: true
9:47:39 PM: buildId: 62edc80fa304d7646b762ae0
9:47:39 PM: deployId: 62edc80fa304d7646b762ae2
9:47:39 PM: systemLogFile: 3
9:47:39 PM:
9:47:39 PM: ❯ Current directory
9:47:39 PM: /opt/build/repo
9:47:39 PM:
9:47:39 PM: ❯ Config file
9:47:39 PM: No config file was defined: using default values.
9:47:39 PM:
9:47:39 PM: ❯ Context
9:47:39 PM: production
9:47:39 PM:
9:47:39 PM: ❯ Installing plugins
9:47:39 PM: - @netlify/plugin-nextjs@4.12.2
9:47:49 PM:
9:47:49 PM: ❯ Loading plugins
9:47:49 PM: - @netlify/plugin-nextjs@4.12.2 from Netlify app
9:47:49 PM:
9:47:49 PM: ────────────────────────────────────────────────────────────────
9:47:49 PM: 1. @netlify/plugin-nextjs (onPreBuild event)
9:47:49 PM: ────────────────────────────────────────────────────────────────
9:47:49 PM:
9:47:49 PM: No Next.js cache to restore.
9:47:49 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
9:47:49 PM:
9:47:49 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms)
9:47:49 PM:
9:47:49 PM: ────────────────────────────────────────────────────────────────
9:47:49 PM: 2. Build command from Netlify app
9:47:49 PM: ────────────────────────────────────────────────────────────────
9:47:49 PM:
9:47:49 PM: $ npm run build
9:47:50 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
9:47:50 PM: npm WARN config location in the cache, and they are managed by
9:47:50 PM: npm WARN config [`cacache`](http://npm.im/cacache).
9:47:50 PM: > react-web-coupons@0.1.0 build
9:47:50 PM: > next build
9:47:50 PM: warn - You have enabled experimental feature(s).
9:47:50 PM: warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.
9:47:50 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
9:47:50 PM: info - Checking validity of types...
9:47:50 PM: warn - No ESLint configuration detected. Run next lint to begin setup
9:47:50 PM: info - Creating an optimized production build...
9:48:36 PM: info - Compiled successfully
9:48:36 PM: info - Collecting page data...
9:48:44 PM: node:internal/process/promises:279
9:48:44 PM: triggerUncaughtException(err, true /* fromPromise */);
9:48:44 PM: ^
9:48:44 PM: Error: API url is missing!
9:48:44 PM: at Object.7298 (/opt/build/repo/.next/server/chunks/7298.js:21:11)
9:48:44 PM: at __webpack_require__ (/opt/build/repo/.next/server/webpack-runtime.js:25:42)
9:48:44 PM: at /opt/build/repo/.next/server/pages/_app.js:39:66
9:48:44 PM: at Function.__webpack_require__.a (/opt/build/repo/.next/server/webpack-runtime.js:103:13)
9:48:44 PM: at Object.2654 (/opt/build/repo/.next/server/pages/_app.js:11:21)
9:48:44 PM: at __webpack_require__ (/opt/build/repo/.next/server/webpack-runtime.js:25:42)
9:48:44 PM: at __webpack_exec__ (/opt/build/repo/.next/server/pages/_app.js:316:39)
9:48:44 PM: at /opt/build/repo/.next/server/pages/_app.js:317:82
9:48:44 PM: at Function.__webpack_require__.X (/opt/build/repo/.next/server/webpack-runtime.js:190:21)
9:48:44 PM: at /opt/build/repo/.next/server/pages/_app.js:317:47 {
9:48:44 PM: type: 'Error'
9:48:44 PM: }
9:48:46 PM:
9:48:46 PM: ────────────────────────────────────────────────────────────────
9:48:46 PM: "build.command" failed
9:48:46 PM: ────────────────────────────────────────────────────────────────
9:48:46 PM:
9:48:46 PM: Error message
9:48:46 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
9:48:46 PM:
9:48:46 PM: Error location
9:48:46 PM: In Build command from Netlify app:
9:48:46 PM: npm run build
9:48:46 PM:
9:48:46 PM: Resolved config
9:48:46 PM: build:
9:48:46 PM: base: /opt/build/repo
9:48:46 PM: command: npm run build
9:48:46 PM: commandOrigin: ui
9:48:46 PM: environment:
9:48:46 PM: - CI
9:48:46 PM: - NEXT_PUBLIC_FIREBASE_API_ID
9:48:46 PM: - NEXT_PUBLIC_FIREBASE_API_KEY
9:48:46 PM: - NEXT_PUBLIC_MEASURMENT_ID
9:48:46 PM: - NEXT_PUBLIC_SENDER_ID
9:48:46 PM: - NPM_FLAGS
9:48:46 PM: - NEXT_PRIVATE_TARGET
9:48:46 PM: publish: /opt/build/repo/public
9:48:46 PM: publishOrigin: ui
9:48:46 PM: plugins:
9:48:46 PM: - inputs: {}
9:48:46 PM: origin: ui
9:48:46 PM: package: '@netlify/plugin-nextjs'
9:48:47 PM: Caching artifacts
9:48:47 PM: Started saving node modules
9:48:47 PM: Finished saving node modules
9:48:47 PM: Started saving build plugins
9:48:47 PM: Finished saving build plugins
9:48:47 PM: Started saving yarn cache
9:48:52 PM: Finished saving yarn cache
9:48:52 PM: Started saving pip cache
9:48:52 PM: Finished saving pip cache
9:48:52 PM: Started saving emacs cask dependencies
9:48:52 PM: Finished saving emacs cask dependencies
9:48:52 PM: Started saving maven dependencies
9:48:52 PM: Finished saving maven dependencies
9:48:52 PM: Started saving boot dependencies
9:48:52 PM: Finished saving boot dependencies
9:48:52 PM: Started saving rust rustup cache
9:48:52 PM: Finished saving rust rustup cache
9:48:52 PM: Started saving go dependencies
9:48:52 PM: Finished saving go dependencies
9:48:52 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:48:52 PM: Creating deploy upload records
9:48:53 PM: Failing build: Failed to build site
9:48:53 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
9:48:53 PM: Finished processing build request in 1m55.955214347s