Vercel Deployment Error: Command "npm run build" exited with 1

16,615

Solution 1

Check whether your codes don't have any warnings. If they have warnings try to fix them and deploy again or ignore them by setting environment variable CI to false. It would look like this:

CI = false

Solution 2

If you are getting this error:

  1. Go to your project setting in vercel.com.
  2. Go to General.
  3. In the "Build & Development Settings", override the Build command and write CI='' npm run build.

This solved the error for me.

Share:
16,615
Alper Tellioğlu
Author by

Alper Tellioğlu

Updated on June 19, 2022

Comments

  • Alper Tellioğlu
    Alper Tellioğlu almost 2 years

    I am developing a React app in VS Code. I used create-react-app for setup. I can run the project without any problem with npm start. When I tried to publish the project with Vercel I got errors:

    Already tried deleting node_modules and npm install again.

    Error! Command "npm run build" exited with 1
    Error! Check your logs at https://...
    

    You can see the logs below:

    13:55:05.231    Retrieving list of deployment files...
    13:55:06.975    Downloading 32 deployment files...
    13:55:09.142    Analyzing source code...
    13:55:11.289    Installing build runtime...
    13:55:15.911    Build runtime installed: 4622.485ms
    13:55:20.151    Looking up build cache...
    13:55:21.237    Build cache not found
    13:55:22.615    Detected package.json
    13:55:22.616    Installing dependencies...
    13:55:58.492    > [email protected] postinstall /vercel/path0/node_modules/babel-runtime/node_modules/core-js
    13:55:58.492    > node -e "try{require('./postinstall')}catch(e){}"
    13:55:58.604    > [email protected] postinstall /vercel/path0/node_modules/core-js
    13:55:58.604    > node -e "try{require('./postinstall')}catch(e){}"
    13:55:58.683    > [email protected] postinstall /vercel/path0/node_modules/core-js-pure
    13:55:58.683    > node -e "try{require('./postinstall')}catch(e){}"
    13:55:58.801    > [email protected] postinstall /vercel/path0/node_modules/ejs
    13:55:58.802    > node ./postinstall.js
    13:56:01.182    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/webpack-dev-server/node_modules/fsevents):
    13:56:01.182    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    13:56:01.191    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/watchpack-chokidar2/node_modules/fsevents):
    13:56:01.191    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    13:56:01.202    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
    13:56:01.202    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    13:56:01.210    added 1985 packages from 812 contributors in 37.99s
    13:56:02.556    137 packages are looking for funding
    13:56:02.556      run `npm fund` for details
    13:56:02.831    Running "npm run build"
    13:56:03.100    > [email protected] build /vercel/path0
    13:56:03.100    > react-scripts build
    13:56:04.846    Creating an optimized production build...
    13:56:23.548    Treating warnings as errors because process.env.CI = true.
    13:56:23.548    Most CI servers set it automatically.
    13:56:23.548    Failed to compile.
    13:56:23.549    src/components/Counter.js
    13:56:23.549      Line 21:6:  React Hook useEffect has a missing dependency: 'props.timeEnds'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
    13:56:23.577    npm ERR! code ELIFECYCLE
    13:56:23.578    npm ERR! errno 1
    13:56:23.581    npm ERR! [email protected] build: `react-scripts build`
    13:56:23.581    npm ERR! Exit status 1
    13:56:23.583    npm ERR! 
    13:56:23.583    npm ERR! Failed at the [email protected] build script.
    13:56:23.583    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    13:56:23.592    npm ERR! A complete log of this run can be found in:
    13:56:23.592    npm ERR!     /vercel/.npm/_logs/2021-03-28T10_56_23_582Z-debug.log
    13:56:23.606    Error: Command "npm run build" exited with 1
    
    • need_to_know_now
      need_to_know_now about 3 years
      You need to make sure all the warnings in your terminal are cleared/rectified before you build it because builds will fail since process.env.CI = true to ensure only robust code with good practices is deployed.
    • need_to_know_now
      need_to_know_now about 3 years
      Happy to help! Always remember to read the logs carefully, they exist for a reason! :)
  • Blessing
    Blessing about 3 years
    Anytime @AlperTellioğlu