How will i fix "build.command" failed error for my express application while publishing on netlify

Hi everyone,

I get an error while publishing my express app on netlify. The error snippets is here:

10:11:01 AM: Build ready to start

10:11:04 AM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
10:11:04 AM: build-image tag: v3.4.1
10:11:04 AM: buildbot version: 8c957a6d09a03023cea4239847cc73a9cb64eeb7
10:11:04 AM: Building without cache
10:11:04 AM: Starting to prepare the repo for build
10:11:04 AM: No cached dependencies found. Cloning fresh repo
10:11:04 AM: git clone https://github.com/blockjoin/joedu-nodejs-app
10:11:05 AM: Preparing Git Reference refs/heads/master
10:11:07 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: ‘functions’ versus ‘’ in the Netlify UI
10:11:07 AM: Starting build script
10:11:07 AM: Installing dependencies
10:11:07 AM: Python version set to 2.7
10:11:09 AM: v12.18.0 is already installed.
10:11:10 AM: Now using node v12.18.0 (npm v6.14.4)
10:11:10 AM: Started restoring cached build plugins
10:11:10 AM: Finished restoring cached build plugins
10:11:10 AM: Attempting ruby version 2.7.1, read from environment
10:11:13 AM: Using ruby version 2.7.1
10:11:13 AM: Using PHP version 5.6
10:11:13 AM: 5.2 is already installed.
10:11:13 AM: Using Swift version 5.2
10:11:13 AM: Started restoring cached node modules
10:11:13 AM: Finished restoring cached node modules
10:11:14 AM: Installing NPM modules using NPM version 6.14.4
10:11:20 AM: npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. ‘mkdirp’ itself supports promises now, please switch to that.
10:11:22 AM: npm WARN deprecated multicodec@0.5.7: stable api reached
10:11:22 AM: npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
10:11:23 AM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
10:11:41 AM: > bufferutil@4.0.1 install /opt/build/repo/node_modules/bufferutil
10:11:41 AM: > node-gyp-build
10:11:41 AM: > keccak@3.0.1 install /opt/build/repo/node_modules/keccak
10:11:41 AM: > node-gyp-build || exit 0
10:11:41 AM: > secp256k1@4.0.2 install /opt/build/repo/node_modules/secp256k1
10:11:41 AM: > node-gyp-build || exit 0
10:11:42 AM: > utf-8-validate@5.0.2 install /opt/build/repo/node_modules/utf-8-validate
10:11:42 AM: > node-gyp-build
10:11:42 AM: > web3@1.3.0 postinstall /opt/build/repo/node_modules/web3
10:11:42 AM: > node angular-patch.js
10:11:43 AM: npm WARN Joedu_W3@1.0.0 No repository field.
10:11:43 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
10:11:43 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:11:43 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
10:11:43 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:11:43 AM: added 823 packages from 573 contributors and audited 828 packages in 28.651s
10:11:44 AM: 26 packages are looking for funding
10:11:44 AM: run npm fund for details
10:11:44 AM: found 1 low severity vulnerability
10:11:44 AM: run npm audit fix to fix them, or npm audit for details
10:11:45 AM: NPM modules installed
10:11:45 AM: Started restoring cached go cache
10:11:45 AM: Finished restoring cached go cache
10:11:46 AM: go version go1.14.4 linux/amd64
10:11:46 AM: go version go1.14.4 linux/amd64
10:11:46 AM: Installing missing commands
10:11:46 AM: Verify run directory
10:11:48 AM: ​
10:11:48 AM: ┌─────────────────────────────┐
10:11:48 AM: │ Netlify Build │
10:11:48 AM: └─────────────────────────────┘
10:11:48 AM: ​
10:11:48 AM: ❯ Version
10:11:48 AM: @netlify/build 3.3.5
10:11:48 AM: ​
10:11:48 AM: ❯ Flags
10:11:48 AM: deployId: 5f61ba85d6bec462759d7f17
10:11:48 AM: mode: buildbot
10:11:48 AM: ​
10:11:48 AM: ❯ Current directory
10:11:48 AM: /opt/build/repo
10:11:48 AM: ​
10:11:48 AM: ❯ Config file
10:11:48 AM: /opt/build/repo/netlify.toml
10:11:48 AM: ​
10:11:48 AM: ❯ Context
10:11:48 AM: production
10:11:50 AM: ​
10:11:50 AM: ┌────────────────────────────────────┐
10:11:50 AM: │ 1. build.command from netlify.toml │
10:11:50 AM: └────────────────────────────────────┘
10:11:50 AM: ​
10:11:50 AM: $ CI= npm run build
10:11:50 AM: > Joedu_W3@1.0.0 build /opt/build/repo
10:11:50 AM: > netlify-lambda build src
10:11:51 AM: netlify-lambda: Building functions
10:11:55 AM: ModuleNotFoundError: Module not found: Error: Can’t resolve ‘electron’ in ‘/opt/build/repo/node_modules/swarm-js/node_modules/got’
at /opt/build/repo/node_modules/webpack/lib/Compilation.js:925:10
10:11:55 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:401:22
10:11:55 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:130:21
10:11:55 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:224:22
10:11:55 AM: at /opt/build/repo/node_modules/neo-async/async.js:2830:7
10:11:55 AM: at /opt/build/repo/node_modules/neo-async/async.js:6877:13
10:11:55 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:214:25
10:11:55 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:213:14
10:11:55 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:285:5
10:11:55 AM: at eval (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), :13:1)
10:11:55 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
10:11:55 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:285:5
10:11:55 AM: at eval (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), :13:1)
10:11:55 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:285:5
10:11:55 AM: at eval (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), :25:1)
10:11:55 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
10:11:55 AM: resolve ‘electron’ in ‘/opt/build/repo/node_modules/swarm-js/node_modules/got’
10:11:55 AM: Parsed request is a module
10:11:55 AM: using description file: /opt/build/repo/node_modules/swarm-js/node_modules/got/package.json (relative path: .)
10:11:55 AM: resolve as module
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/got/node_modules doesn’t exist or is not a directory
/opt/build/repo/node_modules/swarm-js/node_modules/node_modules doesn’t exist or is not a directory
/opt/build/repo/node_modules/node_modules doesn’t exist or is not a directory
/opt/build/node_modules doesn’t exist or is not a directory
/opt/node_modules doesn’t exist or is not a directory
/node_modules doesn’t exist or is not a directory
looking for modules in /opt/build/repo/node_modules/swarm-js/node_modules
10:11:55 AM: using description file: /opt/build/repo/node_modules/swarm-js/package.json (relative path: ./node_modules)
10:11:55 AM: using description file: /opt/build/repo/node_modules/swarm-js/package.json (relative path: ./node_modules/electron)
10:11:55 AM: no extension
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/electron doesn’t exist
looking for modules in /opt/build/repo/node_modules
10:11:55 AM: using description file: /opt/build/repo/package.json (relative path: ./node_modules)
10:11:55 AM: using description file: /opt/build/repo/package.json (relative path: ./node_modules/electron)
10:11:55 AM: no extension
10:11:55 AM: /opt/build/repo/node_modules/electron doesn’t exist
.wasm
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/electron.wasm doesn’t exist
.wasm
10:11:55 AM: /opt/build/repo/node_modules/electron.wasm doesn’t exist
.mjs
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/electron.mjs doesn’t exist
.mjs
10:11:55 AM: /opt/build/repo/node_modules/electron.mjs doesn’t exist
.js
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/electron.js doesn’t exist
.js
10:11:55 AM: /opt/build/repo/node_modules/electron.js doesn’t exist
.json
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/electron.json doesn’t exist
.json
10:11:55 AM: /opt/build/repo/node_modules/electron.json doesn’t exist
.ts
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/electron.ts doesn’t exist
.ts
10:11:55 AM: /opt/build/repo/node_modules/electron.ts doesn’t exist
as directory
10:11:55 AM: /opt/build/repo/node_modules/swarm-js/node_modules/electron doesn’t exist
as directory
10:11:55 AM: /opt/build/repo/node_modules/electron doesn’t exist
npm ERR! code ELIFECYCLE
10:11:55 AM: npm ERR! errno 1
10:11:55 AM: npm ERR! Joedu_W3@1.0.0 build: netlify-lambda build src
10:11:55 AM: npm ERR! Exit status 1
10:11:55 AM: npm ERR!
10:11:55 AM: npm ERR! Failed at the Joedu_W3@1.0.0 build script.
10:11:55 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:11:55 AM: npm ERR! A complete log of this run can be found in:
10:11:55 AM: npm ERR! /opt/buildhome/.npm/_logs/2020-09-16T07_11_55_240Z-debug.log
10:11:55 AM: ​
10:11:55 AM: ┌─────────────────────────────┐
10:11:55 AM: │ “build.command” failed │
10:11:55 AM: └─────────────────────────────┘
10:11:55 AM: ​
10:11:55 AM: Error message
10:11:55 AM: Command failed with exit code 1: CI= npm run build
10:11:55 AM: ​
10:11:55 AM: Error location
10:11:55 AM: In build.command from netlify.toml:
10:11:55 AM: CI= npm run build
10:11:55 AM: ​
10:11:55 AM: Resolved config
10:11:55 AM: build:
10:11:55 AM: command: CI= npm run build
10:11:55 AM: commandOrigin: config
10:11:55 AM: functions: /opt/build/repo/functions
10:11:55 AM: publish: /opt/build/repo/dist
10:11:55 AM: Caching artifacts
10:11:55 AM: Started saving node modules
10:11:55 AM: Finished saving node modules
10:11:55 AM: Started saving build plugins
10:11:55 AM: Finished saving build plugins
10:11:55 AM: Started saving pip cache
10:11:55 AM: Finished saving pip cache
10:11:55 AM: Started saving emacs cask dependencies
10:11:55 AM: Finished saving emacs cask dependencies
10:11:55 AM: Started saving maven dependencies
10:11:55 AM: Finished saving maven dependencies
10:11:55 AM: Started saving boot dependencies
10:11:55 AM: Finished saving boot dependencies
10:11:55 AM: Started saving go dependencies
10:11:55 AM: Finished saving go dependencies
10:11:59 AM: Error running command: Build script returned non-zero exit code: 1
10:11:59 AM: Failing build: Failed to build site
10:11:59 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
10:11:59 AM: Finished processing build request in 55.11118327s

I set the Build command as CI= npm run build but i get this error again.
how can i fix this?

thank you,

Hi @yasemincirt, I don’t think that the issue is the CI env var, as the thing that is causing your build to fail is not a warning but the error I quoted above. You’ll want to resolve why your build is trying to use electron which won’t work on our system since that’s meant for the desktop and not the web.

Hope that helps.