# Deploy failed NPM

**URL:** <https://answers.netlify.com/t/deploy-failed-npm/73164>\
**Category:** Support\
**Tags:** building\
**Created:** [August 10, 2022, 3:04pm UTC](https://answers.netlify.com/t/deploy-failed-npm/73164 "2022-08-10T15:04:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chags](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/chags/32/40108_2.png) [@chags](https://answers.netlify.com/u/chags)\
**Post date:** [August 10, 2022, 3:04pm UTC](https://answers.netlify.com/t/deploy-failed-npm/73164/1 "2022-08-10T15:04:42Z")

</div>

On my machine it works. I do not know what is happening. Just don’t build

```auto
3:29:45 PM: Build ready to start
3:30:08 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
3:30:08 PM: build-image tag: v4.10.1
3:30:08 PM: buildbot version: fe6512288e75c8fa5aadaebb51ed1f96e9314fd4
3:30:08 PM: Fetching cached dependencies
3:30:08 PM: Failed to fetch cache, continuing with build
3:30:08 PM: Starting to prepare the repo for build
3:30:08 PM: No cached dependencies found. Cloning fresh repo
3:30:08 PM: git clone https://github.com/chags/texnet
3:30:09 PM: Preparing Git Reference refs/heads/main
3:30:10 PM: Parsing package.json dependencies
3:30:11 PM: Starting build script
3:30:11 PM: Installing dependencies
3:30:11 PM: Python version set to 2.7
3:30:12 PM: v16.16.0 is already installed.
3:30:12 PM: Now using node v16.16.0 (npm v8.11.0)
3:30:12 PM: Started restoring cached build plugins
3:30:12 PM: Finished restoring cached build plugins
3:30:12 PM: Attempting ruby version 2.7.2, read from environment
3:30:13 PM: Using ruby version 2.7.2
3:30:13 PM: Using PHP version 8.0
3:30:13 PM: No npm workspaces detected
3:30:13 PM: Started restoring cached node modules
3:30:13 PM: Finished restoring cached node modules
3:30:14 PM: Installing NPM modules using NPM version 8.11.0
3:30:14 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
3:30:14 PM: npm WARN config location in the cache, and they are managed by
3:30:14 PM: npm WARN config [`cacache`](http://npm.im/cacache).
3:30:14 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
3:30:14 PM: npm WARN config location in the cache, and they are managed by
3:30:14 PM: npm WARN config [`cacache`](http://npm.im/cacache).
3:30:15 PM: npm ERR! code ERESOLVE
3:30:15 PM: npm ERR! ERESOLVE could not resolve
3:30:15 PM: npm ERR!
3:30:15 PM: npm ERR! While resolving: react-customizable-progressbar@1.0.3
3:30:15 PM: Creating deploy upload records
3:30:15 PM: npm ERR! Found: react@18.2.0
3:30:15 PM: npm ERR! node_modules/react
3:30:15 PM: npm ERR! react@"^18.2.0" from the root project
3:30:15 PM: npm ERR! peer react@">=16.3" from @fortawesome/react-fontawesome@0.2.0
3:30:15 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
3:30:15 PM: npm ERR! node_modules/@fortawesome/react-fontawesome
3:30:15 PM: npm ERR! @fortawesome/react-fontawesome@"^0.2.0" from the root project
3:30:15 PM: npm ERR! 22 more (@react-aria/ssr, @restart/hooks, @restart/ui, ...)
3:30:15 PM: npm ERR!
3:30:15 PM: npm ERR! Could not resolve dependency:
3:30:15 PM: npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from react-customizable-progressbar@1.0.3
3:30:15 PM: npm ERR! node_modules/react-customizable-progressbar
3:30:15 PM: npm ERR! react-customizable-progressbar@"^1.0.3" from the root project
3:30:15 PM: npm ERR!
3:30:15 PM: npm ERR! Conflicting peer dependency: react@17.0.2
3:30:15 PM: npm ERR! node_modules/react
3:30:15 PM: npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from react-customizable-progressbar@1.0.3
3:30:15 PM: npm ERR! node_modules/react-customizable-progressbar
3:30:15 PM: npm ERR! react-customizable-progressbar@"^1.0.3" from the root project
3:30:15 PM: npm ERR!
3:30:15 PM: npm ERR! Fix the upstream dependency conflict, or retry
3:30:15 PM: npm ERR! this command with --force, or --legacy-peer-deps
3:30:15 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
3:30:15 PM: npm ERR!
3:30:15 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
3:30:15 PM: npm ERR! A complete log of this run can be found in:
3:30:15 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-08-09T18_30_14_590Z-debug-0.log
3:30:15 PM: Error during NPM install
3:30:15 PM: Build was terminated: Build script returned non-zero exit code: 1
3:30:15 PM: Failing build: Failed to build site
3:30:15 PM: Finished processing build request in 7.705531885s

```

---

<div class="post-metadata">

**Author:** ![gualter](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gualter/32/35068_2.png) [@gualter](https://answers.netlify.com/u/gualter)\
**Post date:** [August 10, 2022, 4:48pm UTC](https://answers.netlify.com/t/deploy-failed-npm/73164/2 "2022-08-10T16:48:39Z")

</div>

Hi @chags

This is probably happening due to a mismatch in `node` or `npm` versions. Can you try adding the recommended `--legacy-peer-deps` flag using a build [environment variable](https://docs.netlify.com/configure-builds/environment-variables/#netlify-configuration-variables):

`NODE_ENV`= `--legacy-peer-deps`

Hope this helps!

---

<div class="post-metadata">

**Author:** ![chags](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/chags/32/40108_2.png) [@chags](https://answers.netlify.com/u/chags)\
**Post date:** [August 12, 2022, 12:31pm UTC](https://answers.netlify.com/t/deploy-failed-npm/73164/3 "2022-08-12T12:31:39Z")

</div>

> [@gualter](#):
>
> –legacy-peer-deps

I do not know how to do this? I created the variable but it still gives error

---

<div class="post-metadata">

**Author:** ![nathanmartin](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nathanmartin/32/30845_2.png) [@nathanmartin](https://answers.netlify.com/u/nathanmartin)\
**Post date:** [August 12, 2022, 2:06pm UTC](https://answers.netlify.com/t/deploy-failed-npm/73164/4 "2022-08-12T14:06:55Z")

</div>

@chags You may have already entered the value correctly, but see this:

> [@Deploy failed today: Build was terminated: Build script returned non-zero exit code: 1](https://answers.netlify.com/t/deploy-failed-today-build-was-terminated-build-script-returned-non-zero-exit-code-1/64450/2):
>
> The error is a peer dependency conflict relating to versions of react, which provides guidance on how you can attempt to resolve it: 11:06:39 AM: npm ERR! Fix the upstream dependency conflict, or retry 11:06:39 AM: npm ERR! this command with --force, or --legacy-peer-deps 11:06:39 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution. It suggests you can run npm install --force or npm install --legacy-peer-deps. To do this on Netlify you can use the [NPM\_FLAGS](https://docs.netlify.com/configure-builds/manage-dependencies/#npm) envi…
