"build.command" failed

I’ve tried running: npm run build, CI= npm run build, CI= ‘’ npm run build to no avail.

After hours of troubleshooting and my limited experience with Netlify (3 years ago) I may be missing something very obvious but I can’t seem to find any solutions online. Logs are listed below. If more information is needed I will post. Any help will be appreciated.

6:06:06 PM: Netlify Build
6:06:06 PM: ────────────────────────────────────────────────────────────────
6:06:06 PM: ​
6:06:06 PM: ❯ Version
6:06:06 PM: @netlify/build 29.22.5
6:06:06 PM: ​
6:06:06 PM: ❯ Flags
6:06:06 PM: baseRelDir: true
6:06:06 PM: buildId: 652889c4bf495635a7e6c255
6:06:06 PM: deployId: 652889c4bf495635a7e6c257
6:06:06 PM: ​
6:06:06 PM: ❯ Current directory
6:06:06 PM: /opt/build/repo
6:06:06 PM: ​
6:06:06 PM: ❯ Config file
6:06:06 PM: No config file was defined: using default values.
6:06:06 PM: ​
6:06:06 PM: ❯ Context
6:06:06 PM: production
6:06:06 PM: ​
6:06:06 PM: Build command from Netlify app
6:06:06 PM: ────────────────────────────────────────────────────────────────
6:06:06 PM: ​
6:06:06 PM: $ npm run build
6:06:06 PM: > Lavelo@0.1.0 build
6:06:06 PM: > react-scripts build
6:06:07 PM: Creating an optimized production build…
6:06:07 PM: Error: error:0308010C:digital envelope routines::unsupported
6:06:07 PM: at new Hash (node:internal/crypto/hash:69:19)
6:06:07 PM: at Object.createHash (node:crypto:133:10)
6:06:07 PM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:135:53)
6:06:07 PM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:412:16)
6:06:07 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:463:10)
6:06:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:495:5
6:06:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:354:12
6:06:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
6:06:07 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
6:06:07 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
6:06:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:236:3
6:06:07 PM: at runSyncOrAsync (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
6:06:07 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
6:06:07 PM: at Array. (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
6:06:07 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
6:06:07 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
6:06:07 PM: /opt/build/repo/node_modules/react-scripts/scripts/build.js:19
6:06:07 PM: throw err;
6:06:07 PM: ^
6:06:07 PM: Error: error:0308010C:digital envelope routines::unsupported
6:06:07 PM: at new Hash (node:internal/crypto/hash:69:19)
6:06:07 PM: at Object.createHash (node:crypto:133:10)
6:06:07 PM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:135:53)
6:06:07 PM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:412:16)
6:06:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:444:10
6:06:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:320:13
6:06:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:367:11
6:06:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:233:18
6:06:07 PM: at context.callback (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
6:06:07 PM: at /opt/build/repo/node_modules/babel-loader/lib/index.js:55:103 {
6:06:07 PM: opensslErrorStack: [ “error:03000086:digital envelope routines::initialization error” ],
6:06:07 PM: library: “digital envelope routines”,
6:06:07 PM: reason: “unsupported”,
6:06:07 PM: code: “ERR_OSSL_EVP_UNSUPPORTED”
6:06:07 PM: }
6:06:07 PM: Node.js v18.18.1
6:06:07 PM: ​
6:06:07 PM: “build.command” failed
6:06:07 PM: ────────────────────────────────────────────────────────────────
6:06:07 PM: ​
6:06:07 PM: Error message
6:06:07 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
6:06:07 PM: ​
6:06:07 PM: Error location
6:06:07 PM: In Build command from Netlify app:
6:06:07 PM: npm run build
6:06:07 PM: ​
6:06:07 PM: Resolved config
6:06:07 PM: build:
6:06:07 PM: command: npm run build
6:06:07 PM: commandOrigin: ui
6:06:07 PM: publish: /opt/build/repo/build
6:06:07 PM: publishOrigin: ui
6:06:09 PM: Failed during stage “building site”: Build script returned non-zero exit code: 2
6:06:09 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:06:09 PM: Failing build: Failed to build site
6:06:09 PM: Finished processing build request in 43.839s

────────────────────────────────────────────────────────────────
In case it is needed this is my package.json file as well.

{
“name”: “Lavelo”,
“version”: “0.1.0”,
“private”: true,
“dependencies”: {
“bootstrap”: “^4.3.1”,
“eslint”: “^6.1.0”,
“react”: “^16.12.0”,
“react-anchor-link-smooth-scroll”: “^1.0.12”,
“react-animated-css”: “^1.2.1”,
“react-countdown-now”: “^2.1.2”,
“react-dom”: “^16.12.0”,
“react-fancybox”: “^0.2.5”,
“react-fontawesome”: “^1.7.1”,
“react-owl-carousel”: “^2.3.1”,
“react-particles-js”: “^2.7.1”,
“react-router-dom”: “^5.1.2”,
“react-scripts”: “3.1.1”,
“react-slick”: “^0.25.2”,
“react-sticky-header”: “^0.2.0”,
“reactjs-countdown”: “0.0.8”,
“reactstrap”: “^8.2.0”,
“slick-carousel”: “^1.8.1”
},
“scripts”: {
“start”: “react-scripts --openssl-legacy-provider start”,
“build”: “react-scripts build”,
“test”: “react-scripts test”,
“eject”: “react-scripts eject”
},
“eslintConfig”: {
“extends”: “react-app”
},
“browserslist”: {
“production”: [
“>0.2%”,
“not dead”,
“not op_mini all”
],
“development”: [
“last 1 chrome version”,
“last 1 firefox version”,
“last 1 safari version”
]
}
}

@nidoking The section of the log you’ve provided shows “that it failed”, but provides no insight into “why it failed”.

If you provide the entire build log someone should be able to assist.

@nathanmartin I have posted the full build log as well as the package.json file. Thank you for the quick response. If any additional information is needed please let me know!

@nidoking The relevant error is:

See:

I tried just about everything on that link. The solution for me was multifaceted. I appreciate your quick and helpful responses.

  1. Redeploy project
  2. Use “yarn run build”
  3. Use Node 16x
  4. Create Environmental Variable
    Key parameter set to: CI
    Value parameter set to: False

@nidoking Getting a build running is almost always is multifaceted, as there’s usually more than one thing wrong.

Glad you were able to get your configuration sorted out.