Home
Support Forums

I have tried CI= npm run build but still “build.command” failed

PLEASE help me,

My build log o my local machine no errors at all, on netlify, there is an error with the build, I tried to put CI= npm run build for build command but still failed:

7:27:28 PM: Build ready to start
7:27:30 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
7:27:30 PM: build-image tag: v3.6.1
7:27:30 PM: buildbot version: 4664c676ab2e0ffa6759f80443163cc83846b019
7:27:30 PM: Building without cache
7:27:30 PM: Starting to prepare the repo for build
7:27:30 PM: No cached dependencies found. Cloning fresh repo
7:27:30 PM: git clone https://github.com/kirillibrahim/Major_World
7:27:32 PM: Preparing Git Reference refs/heads/master
7:27:34 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘build’ versus ‘build/’ in the Netlify UI
7:27:34 PM: Starting build script
7:27:34 PM: Installing dependencies
7:27:34 PM: Python version set to 2.7
7:27:36 PM: v12.18.0 is already installed.
7:27:36 PM: Now using node v12.18.0 (npm v6.14.4)
7:27:36 PM: Started restoring cached build plugins
7:27:36 PM: Finished restoring cached build plugins
7:27:37 PM: Attempting ruby version 2.7.1, read from environment
7:27:38 PM: Using ruby version 2.7.1
7:27:39 PM: Using PHP version 5.6
7:27:39 PM: Started restoring cached node modules
7:27:39 PM: Finished restoring cached node modules
7:27:39 PM: Started restoring cached yarn cache
7:27:39 PM: Finished restoring cached yarn cache
7:27:39 PM: Installing yarn at version 1.22.4
7:27:39 PM: Installing Yarn!
7:27:39 PM: > Downloading tarball…
7:27:39 PM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz → /tmp/yarn.tar.gz.lLz0EoBakl
7:27:39 PM: % Total % Received % Xferd Average Speed Time Time Time Current
7:27:39 PM: Dload Upload Total Spent Left Speed
7:27:39 PM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
7:27:39 PM: 100 80 100 80 0 0 315 0 --:–:-- --:–:-- --:–:-- 314
7:27:39 PM: 100 80 100 80 0 0 315 0 --:–:-- --:–:-- --:–:-- 314
7:27:39 PM: 100 93 100 93 0 0 166 0 --:–:-- --:–:-- --:–:-- 166
7:27:40 PM: 100 625 100 625 0 0 734 0 --:–:-- --:–:-- --:–:-- 734
7:27:40 PM: 100 1215k 100 1215k 0 0 988k 0 0:00:01 0:00:01 --:–:-- 988k
7:27:40 PM: [2/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc → /tmp/yarn.tar.gz.lLz0EoBakl.asc
7:27:40 PM: 100 84 100 84 0 0 1337 0 --:–:-- --:–:-- --:–:-- 1337
7:27:40 PM: 100 84 100 84 0 0 1334 0 --:–:-- --:–:-- --:–:-- 0
7:27:40 PM: 100 97 100 97 0 0 1045 0 --:–:-- --:–:-- --:–:-- 1045
7:27:40 PM: 100 629 100 629 0 0 5233 0 --:–:-- --:–:-- --:–:-- 5233
7:27:40 PM: 100 1028 100 1028 0 0 7739 0 --:–:-- --:–:-- --:–:-- 7739
7:27:40 PM: > Verifying integrity…
7:27:40 PM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
7:27:40 PM: gpg: Good signature from “Yarn Packaging yarn@dan.cx
7:27:40 PM: gpg: Note: This key has expired!
7:27:40 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
7:27:40 PM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
7:27:40 PM: > GPG signature looks good
7:27:40 PM: > Extracting to ~/.yarn…
7:27:40 PM: > Adding to PATH... 7:27:41 PM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available. 7:27:41 PM: Installing NPM modules using Yarn version 1.22.4 7:27:42 PM: yarn install v1.22.4 7:27:42 PM: [1/4] Resolving packages... 7:27:43 PM: [2/4] Fetching packages... 7:28:06 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module. 7:28:06 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. 7:28:06 PM: info fsevents@2.3.1: The platform "linux" is incompatible with this module. 7:28:06 PM: info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation. 7:28:06 PM: info fsevents@1.2.13: The platform "linux" is incompatible with this module. 7:28:06 PM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation. 7:28:06 PM: [3/4] Linking dependencies... 7:28:06 PM: warning " > react-highlight-words@0.16.0" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0-0". 7:28:18 PM: [4/4] Building fresh packages... 7:28:23 PM: success Saved lockfile. 7:28:23 PM: Done in 40.85s. 7:28:23 PM: NPM modules installed using Yarn 7:28:23 PM: Started restoring cached go cache 7:28:23 PM: Finished restoring cached go cache 7:28:24 PM: go version go1.14.4 linux/amd64 7:28:24 PM: go version go1.14.4 linux/amd64 7:28:24 PM: Installing missing commands 7:28:24 PM: Verify run directory 7:28:26 PM: ​ 7:28:26 PM: ──────────────────────────────────────────────────────────────── 7:28:26 PM: Netlify Build 7:28:26 PM: ──────────────────────────────────────────────────────────────── 7:28:26 PM: ​ 7:28:26 PM: ❯ Version 7:28:26 PM: @netlify/build 9.7.0 7:28:26 PM: ​ 7:28:26 PM: ❯ Flags 7:28:26 PM: deployId: 603fc70035597a838ac40fa9 7:28:26 PM: mode: buildbot 7:28:26 PM: ​ 7:28:26 PM: ❯ Current directory 7:28:26 PM: /opt/build/repo 7:28:26 PM: ​ 7:28:26 PM: ❯ Config file 7:28:26 PM: /opt/build/repo/netlify.toml 7:28:26 PM: ​ 7:28:26 PM: ❯ Context 7:28:26 PM: production 7:28:26 PM: ​ 7:28:26 PM: ──────────────────────────────────────────────────────────────── 7:28:26 PM: 1. Build command from Netlify app 7:28:26 PM: ──────────────────────────────────────────────────────────────── 7:28:26 PM: ​ 7:28:26 PM: CI= npm run build
7:28:27 PM: > major-world@0.1.0 build /opt/build/repo
7:28:27 PM: > next build
7:28:28 PM: Browserslist: caniuse-lite is outdated. Please run:
7:28:28 PM: npx browserslist@latest --update-db
7:28:28 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
7:28:28 PM: info - Creating an optimized production build…
7:28:28 PM: It looks like you’re trying to use TypeScript but do not have the required package(s) installed.
7:28:28 PM: Please install typescript by running:
7:28:28 PM: yarn add --dev typescript
7:28:28 PM: If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).
7:28:28 PM: npm ERR! code ELIFECYCLE
7:28:28 PM: npm ERR! errno 1
7:28:28 PM: npm ERR! major-world@0.1.0 build: next build
7:28:28 PM: npm ERR! Exit status 1
7:28:28 PM: npm ERR!
7:28:28 PM: npm ERR! Failed at the major-world@0.1.0 build script.
7:28:28 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
7:28:28 PM: npm ERR! A complete log of this run can be found in:
7:28:28 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-03-03T17_28_28_672Z-debug.log
7:28:28 PM: ​
7:28:28 PM: ────────────────────────────────────────────────────────────────
7:28:28 PM: “build.command” failed
7:28:28 PM: ────────────────────────────────────────────────────────────────
7:28:28 PM: ​
7:28:28 PM: Error message
7:28:28 PM: Command failed with exit code 1: CI= npm run build
7:28:28 PM: ​
7:28:28 PM: Error location
7:28:28 PM: In Build command from Netlify app:
7:28:28 PM: CI= npm run build
7:28:28 PM: ​
7:28:28 PM: Resolved config
7:28:28 PM: build:
7:28:28 PM: command: CI= npm run build
7:28:28 PM: commandOrigin: ui
7:28:28 PM: environment:
7:28:28 PM: - CI
7:28:28 PM: - NODE_ENV
7:28:28 PM: publish: /opt/build/repo/build
7:28:28 PM: Caching artifacts
7:28:28 PM: Started saving node modules
7:28:28 PM: Finished saving node modules
7:28:28 PM: Started saving build plugins
7:28:28 PM: Finished saving build plugins
7:28:28 PM: Started saving yarn cache
7:28:28 PM: Finished saving yarn cache
7:28:28 PM: Started saving pip cache
7:28:29 PM: Finished saving pip cache
7:28:29 PM: Started saving emacs cask dependencies
7:28:29 PM: Finished saving emacs cask dependencies
7:28:29 PM: Started saving maven dependencies
7:28:29 PM: Finished saving maven dependencies
7:28:29 PM: Started saving boot dependencies
7:28:29 PM: Finished saving boot dependencies
7:28:29 PM: Started saving rust rustup cache
7:28:29 PM: Finished saving rust rustup cache
7:28:29 PM: Started saving go dependencies
7:28:29 PM: Finished saving go dependencies
7:28:32 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:28:32 PM: Failing build: Failed to build site
7:28:32 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
7:28:33 PM: Finished processing build request in 1m2.920641054s

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

My Package.json:

{

“name”: “major-world”,

“version”: “0.1.0”,

“private”: true,

“scripts”: {

"dev": "next dev",

"build": "next build",

"start": "next start",

"deploy": "next build && netlify deploy --prod"

},

“dependencies”: {

"@babel/core": "^7.12.9",

"@babel/preset-env": "^7.12.7",

"@babel/register": "^7.12.1",

"@types/node": "^14.14.8",

"@types/react": "^16.9.56",

"antd": "^4.8.5",

"axios": "^0.21.0",

"chart.js": "^2.9.4",

"dom-to-image": "^2.6.0",

"file-saver": "^2.0.5",

"next": "10.0.2",

"react": "17.0.1",

"react-chartjs-2": "^2.11.1",

"react-dom": "17.0.1",

"react-helmet": "^6.1.0",

"react-highlight-words": "^0.16.0",

"react-redux": "^7.2.2",

"redux": "^4.0.5",

"sass": "^1.29.0"

},

“devDependencies”: {

"@types/react-redux": "^7.1.11",

"@types/redux": "^3.6.0",

"@types/redux-thunk": "^2.1.0",

"typescript": "^4.0.5"

}

}

Move your devDependencies to dependencies.

I found solution, I was using netlify.tom, it was override the CI= npm run build command from the dashboard.

1 Like

Hey there, @kirillibrahim

Thank you for sharing this solution :netliconfetti: ! This will help future community members that may encounter a similar issue, so we definitely appreciate it.