Failing to install Angular dependencies

Hi. I’m trying my first Netlify deployment, through GIT and it’s failing to install all dependencies. It works locally on a brand new environment, but not on Netlify. Here are the logs:

4:43:54 PM: Failed during stage ‘Install dependencies’: dependency_installation script returned non-zero exit code: 1
4:43:22 PM: build-image version: 20e1f1f500e4cbad9ea8a99bd40807bef3093551 (focal)
4:43:22 PM: buildbot version: 77071362d8e2c4892a900c59914f4f5b20867e29
4:43:22 PM: Building without cache
4:43:22 PM: Starting to prepare the repo for build
4:43:22 PM: No cached dependencies found. Cloning fresh repo
4:43:22 PM: git clone --filter=blob:none https://github.com/[REDACTED]/[REDACTED]
4:43:22 PM: Preparing Git Reference refs/heads/master
4:43:24 PM:

❯ Initial build environment
baseRelDir: true
branch: master
context: production
cwd: /opt/build/repo
featureFlags:
mode: buildbot
repositoryRoot: /opt/build/repo
siteId: 9c6b0463-cc47-4b45-9904-4368d29fc572

❯ UI build settings
baseRelDir: true
build:
command: npm run build --environment=production
environment:
- NETLIFY_BUILD_DEBUG
- NODE_ENV
- NODE_VERSION
- NPM_FLAGS
publish: dist/drum-client

❯ Resolved build environment
branch: master
buildDir: /opt/build/repo
context: production
env:

❯ Resolved config
build:
command: npm run build --environment=production
commandOrigin: ui
environment:
- NETLIFY_BUILD_DEBUG
- NODE_ENV
- NODE_VERSION
- NPM_FLAGS
publish: /opt/build/repo/dist/[REDACTED]
publishOrigin: ui

4:43:25 PM: Starting to install dependencies
4:43:25 PM: Python version set to 3.8
4:43:25 PM: Attempting Ruby version 2.7.2, read from environment
4:43:26 PM: Using Ruby version 2.7.2
4:43:26 PM: Started restoring cached go cache
4:43:26 PM: Finished restoring cached go cache
4:43:27 PM: Installing Go version 1.19.12 (requested 1.19.x)
4:43:32 PM: go version go1.19.12 linux/amd64
4:43:33 PM: Using PHP version 8.0
4:43:34 PM: Downloading and installing node v18.16.0…
4:43:34 PM: Downloading https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz
4:43:34 PM: Computing checksum with sha256sum
4:43:34 PM: Checksums matched!
4:43:37 PM: Now using node v18.16.0 (npm v9.5.1)
4:43:37 PM: Enabling Node.js Corepack
4:43:37 PM: Started restoring cached build plugins
4:43:37 PM: Finished restoring cached build plugins
4:43:37 PM: WARNING: The environment variable ‘NODE_ENV’ is set to ‘production’. Any ‘devDependencies’ in package.json will not be installed
4:43:37 PM: Started restoring cached corepack dependencies
4:43:37 PM: Finished restoring cached corepack dependencies
4:43:37 PM: No npm workspaces detected
4:43:37 PM: Started restoring cached node modules
4:43:37 PM: Finished restoring cached node modules
4:43:37 PM: Installing npm packages using npm version 9.5.1
4:43:37 PM: npm WARN using --force Recommended protections disabled.
4:43:54 PM: npm ERR! code ENOENT
4:43:54 PM: npm ERR! syscall spawn cmd
4:43:54 PM: npm ERR! path /opt/build/repo/node_modules/bufferutil
4:43:54 PM: npm ERR! errno -2
4:43:54 PM: npm ERR! enoent spawn cmd ENOENT
4:43:54 PM: npm ERR! enoent This is related to npm not being able to find a file.
4:43:54 PM: npm ERR! enoent
4:43:54 PM: npm ERR! A complete log of this run can be found in:
4:43:54 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-08-04T23_43_37_918Z-debug-0.log
4:43:54 PM: Error during npm install
4:43:54 PM: Build was terminated: dependency_installation script returned non-zero exit code: 1
4:43:54 PM: Failing build: Failed to install dependencies

I’d assume NODE_ENV production is causing issues. Try removing it.

I tried adding to fix the issue. The problem is the same without any environment variables

Ohhh I think it’s because I have a .npmrc file with content “script-shell=cmd”. Removing it works