Command failed with exit code 1: CI= npm run build (https://ntl.fyi/exit-code-1)

Deployment failed due to this error code:
Command failed with exit code 1: CI= npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)

Deployment log here:
Netlify App

Can someone please help me figure out how I can fix this?

Hey there, @wanyoung.kim :wave:

Thanks for reaching out. Have you looked through solved threads where customers encountered the same error?

Start with these threads and let us know if they get you on the right track!

Hi, thanks for these links but they’re not relevant to my issue since these are apps running with ReactJS alone or Gatsby. Mine is a React Native app.

Hey there, @wanyoung.kim :wave:

Thanks for following up. Often times, exit code messages transcend a framework. So the root cause may still be similar to the threads above.

Does your build work locally? Have you worked through this resource? This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

you can try: node -v && npm -v && npm clean-install && npm run build

Hi @wanyoung.kim

Unfortunately the deploy log you have linked is appears private. Are you able to share the content here?

Hi @coelmay. I made my repository public and deployed it again, and the deploy log looks different. What you’re now seeing as errors were previously showing as warnings. Am I right in stating that most of the errors have to do with dependency issues that I can fix in my JSON file?

10:53:46 AM: Build ready to start

10:54:03 AM: build-image version: d05976bd3309b73a86eaa327bf80e105ff13f5e4 (focal)

10:54:03 AM: build-image tag: v4.13.0

10:54:03 AM: buildbot version: 3a000de5d3727998f3297394596d287d7e49aecd

10:54:03 AM: Fetching cached dependencies

10:54:03 AM: Failed to fetch cache, continuing with build

10:54:03 AM: Starting to prepare the repo for build

10:54:03 AM: No cached dependencies found. Cloning fresh repo

10:54:03 AM: git clone

10:54:04 AM: Preparing Git Reference refs/heads/main

10:54:04 AM: Parsing package.json dependencies

10:54:05 AM: Starting build script

10:54:05 AM: Installing dependencies

10:54:05 AM: Python version set to 2.7

10:54:05 AM: v16.18.0 is already installed.

10:54:06 AM: Now using node v16.18.0 (npm v8.19.2)

10:54:06 AM: Enabling node corepack

10:54:06 AM: Started restoring cached build plugins

10:54:06 AM: Finished restoring cached build plugins

10:54:06 AM: Attempting ruby version 2.7.2, read from environment

10:54:06 AM: Using ruby version 2.7.2

10:54:07 AM: Using PHP version 8.0

10:54:07 AM: No npm workspaces detected

10:54:07 AM: Started restoring cached node modules

10:54:07 AM: Finished restoring cached node modules

10:54:07 AM: Installing NPM modules using NPM version 8.19.2

10:54:09 AM: npm ERR! code ERESOLVE

10:54:09 AM: npm ERR! ERESOLVE unable to resolve dependency tree

10:54:09 AM: npm ERR!

10:54:09 AM: npm ERR! While resolving: platonia_client@0.0.1

10:54:09 AM: Creating deploy upload records

10:54:09 AM: npm ERR! Found: react@16.14.0

10:54:09 AM: npm ERR! node_modules/react

10:54:09 AM: npm ERR! react@“^16.13.1” from the root project

10:54:09 AM: npm ERR! peer react@“^16.8” from @react-native-community/async-storage@1.12.1

10:54:09 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1

10:54:09 AM: npm ERR! node_modules/@react-native-community/async-storage

10:54:09 AM: npm ERR! @react-native-community/async-storage@“^1.11.0” from the root project

10:54:09 AM: npm ERR!

10:54:09 AM: npm ERR! Could not resolve dependency:

10:54:09 AM: npm ERR! peer react@“16.9.0” from react-native@0.61.5

10:54:09 AM: npm ERR! node_modules/react-native

10:54:09 AM: npm ERR! react-native@“^0.61.5” from the root project

10:54:09 AM: npm ERR! peer react-native@“>=0.59” from @react-native-community/async-storage@1.12.1

10:54:09 AM: npm ERR! node_modules/@react-native-community/async-storage

10:54:09 AM: npm ERR! @react-native-community/async-storage@“^1.11.0” from the root project

10:54:09 AM: npm ERR!

10:54:09 AM: npm ERR! Fix the upstream dependency conflict, or retry

10:54:09 AM: npm ERR! this command with --force, or --legacy-peer-deps

10:54:09 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

10:54:09 AM: npm ERR!

10:54:09 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.

10:54:09 AM: npm ERR! A complete log of this run can be found in:

10:54:09 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-10-19T09_54_07_801Z-debug-0.log

10:54:09 AM: Error during NPM install

10:54:09 AM: Build was terminated: Build script returned non-zero exit code: 1

10:54:09 AM: Failing build: Failed to build site

10:54:09 AM: Finished processing build request in 6.101606865s

Thanks @wanyoung.kim

The solution is outlined in the log:

This post explains excellently the issue (although it relates to a different package, the principle is the same.)

You’ll also find other posts in that thread that explain further how to fix the issue.

1 Like

Thank you. I have now fixed all the peer dependency errors. My app is now failing due to the build command of “npm run build” which is not working.

Would you know the best build command to utilize for a React Native web app on Netlify?

I’ve never used React Native, but as I understand, it is for app development. Netlify is for web development, so it is quite possible the two won’t work together.

You should be able to build locally, and use the same command here :slight_smile: This support guide explains a good set of debugging steps: