Build error - env-cmd: not found

I am facing a build issue since yesterday.
Everything worked fine until yesterday at around 3am CET.
Since then I can build my project anymore, it always stops at the build command with the message: env-cmd: not found.

I am using Nextjs in a monorepo with turborepo.
My build command is:
cd ../.. && pnpm run build:saleor-app-checkout
which results in the following command:
env-cmd --no-override -f .env env-cmd --no-override -f .env.local --fallback turbo run build --cache-dir=.turbo "--filter=saleor-app-checkout...

This is the build log:

1:54:54 PM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
1:54:54 PM: build-image tag: v4.15.0
1:54:54 PM: buildbot version: 2a5a77f33577e9d9cab7b600772cda180877aa8c
1:54:54 PM: Building without cache
1:54:54 PM: Starting to prepare the repo for build
1:54:54 PM: No cached dependencies found. Cloning fresh repo
1:54:54 PM: git clone [removed by me]
1:54:56 PM: Preparing Git Reference refs/heads/test
1:54:56 PM: Parsing package.json dependencies
1:54:57 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'apps/saleor-app-checkout/.next' versus '.next' in the Netlify UI
1:54:58 PM: Section completed: initializing
1:54:58 PM: Failed to get framework information, continuing with build
1:54:58 PM: Starting build script
1:54:58 PM: Installing dependencies
1:54:58 PM: Python version set to 2.7
1:54:58 PM: v16.18.1 is already installed.
1:54:59 PM: Now using node v16.18.1 (npm v8.19.2)
1:54:59 PM: Enabling node corepack
1:54:59 PM: Started restoring cached build plugins
1:54:59 PM: Finished restoring cached build plugins
1:54:59 PM: Attempting ruby version 2.7.2, read from environment
1:55:00 PM: Using ruby version 2.7.2
1:55:00 PM: Using PHP version 8.0
1:55:00 PM: No npm workspaces detected
1:55:00 PM: Started restoring cached node modules
1:55:00 PM: Finished restoring cached node modules
1:55:00 PM: Installing NPM modules using NPM version 8.19.2
1:55:00 PM: 8.19.2
1:55:00 PM: NPM modules installed
1:55:00 PM: Creating package sha
1:55:01 PM: Started restoring cached go cache
1:55:01 PM: Finished restoring cached go cache
1:55:02 PM: Installing Go version 1.19.3 (requested 1.19.x)
1:55:06 PM: unset GOOS;
1:55:06 PM: unset GOARCH;
1:55:06 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.19.3.linux.amd64';
1:55:06 PM: export PATH="/opt/buildhome/.gimme/versions/go1.19.3.linux.amd64/bin:${PATH}";
1:55:06 PM: go version >&2;
1:55:06 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.19.3.linux.amd64.env"
1:55:06 PM: go version go1.19.3 linux/amd64
1:55:07 PM: Detected 1 framework(s)
1:55:07 PM: "next" at version "0.0.0"
1:55:07 PM: Installing missing commands
1:55:07 PM: Verify run directory
1:55:08 PM: ​
1:55:08 PM: ────────────────────────────────────────────────────────────────
1:55:08 PM:   Netlify Build                                                 
1:55:08 PM: ────────────────────────────────────────────────────────────────
1:55:08 PM: ​
1:55:08 PM: ❯ Version
1:55:08 PM:   @netlify/build 29.0.0
1:55:08 PM: ​
1:55:08 PM: ❯ Flags
1:55:08 PM:   baseRelDir: true
1:55:08 PM:   buildId: 638f3b8287d9de2532dc1ebc
1:55:08 PM:   deployId: 638f3b8287d9de2532dc1ebe
1:55:08 PM: ​
1:55:08 PM: ❯ Current directory
1:55:08 PM:   /opt/build/repo/apps/saleor-app-checkout
1:55:08 PM: ​
1:55:08 PM: ❯ Config file
1:55:08 PM:   /opt/build/repo/apps/saleor-app-checkout/netlify.toml
1:55:08 PM: ​
1:55:08 PM: ❯ Context
1:55:08 PM:   production
1:55:08 PM: ​
1:55:08 PM: ❯ Installing plugins
1:55:08 PM:    - @netlify/plugin-nextjs@4.29.2
1:55:15 PM: ​
1:55:15 PM: ❯ Using Next.js Runtime - v4.29.2
1:55:16 PM: ​
1:55:16 PM: ────────────────────────────────────────────────────────────────
1:55:16 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
1:55:16 PM: ────────────────────────────────────────────────────────────────
1:55:16 PM: ​
1:55:16 PM: No Next.js cache to restore.
1:55:16 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
1:55:16 PM: ​
1:55:16 PM: (@netlify/plugin-nextjs onPreBuild completed in 23ms)
1:55:16 PM: ​
1:55:16 PM: ────────────────────────────────────────────────────────────────
1:55:16 PM:   2. Build command from Netlify app                             
1:55:16 PM: ────────────────────────────────────────────────────────────────
1:55:16 PM: ​
1:55:16 PM: $ cd ../.. && pnpm run build:saleor-app-checkout
1:55:17 PM: > saleor-storefront@0.0.0 build:saleor-app-checkout /opt/build/repo
1:55:17 PM: > pnpm run build --filter=saleor-app-checkout...
1:55:17 PM: > saleor-storefront@0.0.0 build /opt/build/repo
1:55:17 PM: > env-cmd --no-override -f .env env-cmd --no-override -f .env.local --fallback turbo run build --cache-dir=.turbo "--filter=saleor-app-checkout..."
1:55:17 PM: sh: 1: env-cmd: not found
1:55:17 PM:  ELIFECYCLE  Command failed.
1:55:17 PM:  WARN   Local package.json exists, but node_modules missing, did you mean to install?
1:55:17 PM:  ELIFECYCLE  Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
1:55:17 PM:  WARN   Local package.json exists, but node_modules missing, did you mean to install?
1:55:18 PM: ​
1:55:18 PM: ────────────────────────────────────────────────────────────────
1:55:18 PM:   "build.command" failed                                        
1:55:18 PM: ────────────────────────────────────────────────────────────────
1:55:18 PM: ​
1:55:18 PM:   Error message
1:55:18 PM:   Command failed with exit code 1: cd ../.. && pnpm run build:saleor-app-checkout (https://ntl.fyi/exit-code-1)
1:55:18 PM: ​
1:55:18 PM:   Error location
1:55:18 PM:   In Build command from Netlify app:
1:55:18 PM:   cd ../.. && pnpm run build:saleor-app-checkout
1:55:18 PM: ​
1:55:18 PM:   Resolved config
1:55:18 PM:   build:
1:55:18 PM:     base: /opt/build/repo/apps/saleor-app-checkout
1:55:18 PM:     command: cd ../.. && pnpm run build:saleor-app-checkout
1:55:18 PM:     commandOrigin: ui
1:55:18 PM:     environment:
1:55:18 PM:       - APL
1:55:18 PM:       - ENABLE_EXPERIMENTAL_COREPACK
1:55:18 PM:       - NEXT_PUBLIC_SALEOR_API_URL
1:55:18 PM:       - NODE_VERSION
1:55:18 PM:       - PNPM_FLAGS
1:55:18 PM:       - SALEOR_APP_TOKEN
1:55:19 PM: Creating deploy upload records
1:55:18 PM:       - SETTINGS_ENCRYPTION_SECRET
1:55:18 PM:       - NPM_FLAGS
1:55:18 PM:       - NEXT_PRIVATE_TARGET
1:55:18 PM:     publish: /opt/build/repo/apps/saleor-app-checkout/.next
1:55:18 PM:     publishOrigin: ui
1:55:18 PM:   plugins:
1:55:19 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:55:18 PM:     - inputs: {}
1:55:18 PM:       origin: config
1:55:18 PM:       package: '@netlify/plugin-nextjs'
1:55:18 PM: Caching artifacts
1:55:18 PM: Started saving node modules
1:55:18 PM: Finished saving node modules
1:55:18 PM: Started saving build plugins
1:55:18 PM: Finished saving build plugins
1:55:18 PM: Started saving pip cache
1:55:18 PM: Finished saving pip cache
1:55:18 PM: Started saving emacs cask dependencies
1:55:18 PM: Finished saving emacs cask dependencies
1:55:18 PM: Started saving maven dependencies
1:55:18 PM: Finished saving maven dependencies
1:55:18 PM: Started saving boot dependencies
1:55:18 PM: Finished saving boot dependencies
1:55:18 PM: Started saving rust rustup cache
1:55:18 PM: Finished saving rust rustup cache
1:55:18 PM: Started saving go dependencies
1:55:18 PM: Finished saving go dependencies
1:55:19 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:55:19 PM: Failing build: Failed to build site
1:55:19 PM: Finished processing build request in 25.234723777s

Anyone else experiencing that issue?
Thanks for any help!

Ok I could resolve the issue.
I added && npm install -g env-cmd to the build command and it built successful.
Strangely now, even when I remove the npm install it builds successfully.

@prometx

Welcome to the community! :tada:

Thanks for letting is know you were able to get this resolved!