Error while deploying netlify

Error: error:0308010C:digital envelope routines::unsupported
10:32:07 PM: at new Hash (node:internal/crypto/hash:71:19)
10:32:07 PM: at Object.createHash (node:crypto:133:10)
10:32:07 PM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:135:53)
10:32:07 PM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:417:16)
10:32:07 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:471:10)
10:32:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
10:32:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
10:32:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
10:32:07 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
10:32:07 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
10:32:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:236:3
10:32:07 PM: at runSyncOrAsync (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
10:32:07 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
10:32:07 PM: at Array. (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
10:32:07 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
10:32:07 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
10:32:07 PM: /opt/build/repo/node_modules/react-scripts/scripts/build.js:19
10:32:07 PM: throw err;
10:32:07 PM: ^
10:32:07 PM: Error: error:0308010C:digital envelope routines::unsupported
10:32:07 PM: at new Hash (node:internal/crypto/hash:71:19)
10:32:07 PM: at Object.createHash (node:crypto:133:10)
10:32:07 PM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:135:53)
10:32:07 PM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:417:16)
10:32:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:452:10
10:32:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:323:13
10:32:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:367:11
10:32:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:233:18
10:32:07 PM: at context.callback (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
10:32:07 PM: at /opt/build/repo/node_modules/react-scripts/node_modules/babel-loader/lib/index.js:59:103 {
10:32:07 PM: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ],
10:32:07 PM: library: ‘digital envelope routines’,
10:32:07 PM: reason: ‘unsupported’,
10:32:07 PM: code: ‘ERR_OSSL_EVP_UNSUPPORTED’
10:32:07 PM: }
10:32:07 PM: Node.js v18.16.0

@MGMarcoGesualdi You will need to prefix your build script with:

NODE_OPTIONS='--openssl-legacy-provider'

If you have something like CI= npm run build set as your build command.
Then your package.json currently has a build script of "react-scripts build".
You would adjust that script to "NODE_OPTIONS='--openssl-legacy-provider' react-scripts build"

idon’t know,
i use craco to run the project or build

@MGMarcoGesualdi That doesn’t change anything about what you should try, only what your build script likely is.

So if your package.json contains a build script of "craco build", you would change that to "NODE_OPTIONS='--openssl-legacy-provider' craco build"

12:14:36 AM: Netlify Build
12:14:36 AM: ────────────────────────────────────────────────────────────────
12:14:36 AM: ​
12:14:36 AM: ❯ Version
12:14:36 AM: @netlify/build 29.21.1
12:14:36 AM: ​
12:14:36 AM: ❯ Flags
12:14:36 AM: baseRelDir: true
12:14:36 AM: buildId: 6518656983a64047446756d0
12:14:36 AM: deployId: 6518656983a64047446756d2
12:14:36 AM: ​
12:14:36 AM: ❯ Current directory
12:14:36 AM: /opt/build/repo
12:14:36 AM: ​
12:14:36 AM: ❯ Config file
12:14:36 AM: No config file was defined: using default values.
12:14:36 AM: ​
12:14:36 AM: ❯ Context
12:14:36 AM: production
12:14:36 AM: ​
12:14:36 AM: Build command from Netlify app
12:14:36 AM: ────────────────────────────────────────────────────────────────
12:14:36 AM: ​
12:14:36 AM: $ npm run build
12:14:36 AM: > githubTest@0.1.0 build
12:14:36 AM: > react-scripts build NODE_OPTIONS=“–openssl-legacy-provider”
12:14:37 AM: Creating an optimized production build…
12:14:37 AM: Error: error:0308010C:digital envelope routines::unsupported
12:14:37 AM: at new Hash (node:internal/crypto/hash:69:19)
12:14:37 AM: at Object.createHash (node:crypto:133:10)
12:14:37 AM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:90:53)
12:14:37 AM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:386:16)
12:14:37 AM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:434:10)
12:14:37 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:466:5
12:14:37 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:327:12
12:14:37 AM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
12:14:37 AM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
12:14:37 AM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
12:14:37 AM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:236:3
12:14:37 AM: at runSyncOrAsync (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
12:14:37 AM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
12:14:37 AM: at Array. (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
12:14:37 AM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
12:14:37 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
12:14:37 AM: /opt/build/repo/node_modules/react-scripts/scripts/build.js:19
12:14:37 AM: throw err;
12:14:37 AM: ^
12:14:37 AM: Error: error:0308010C:digital envelope routines::unsupported
12:14:37 AM: at new Hash (node:internal/crypto/hash:69:19)
12:14:37 AM: at Object.createHash (node:crypto:133:10)
12:14:37 AM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:90:53)
12:14:37 AM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:386:16)
12:14:37 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:418:10
12:14:37 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:293:13
12:14:37 AM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:367:11
12:14:37 AM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:233:18
12:14:37 AM: at context.callback (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
12:14:37 AM: at /opt/build/repo/node_modules/babel-loader/lib/index.js:51:103 {
12:14:37 AM: opensslErrorStack: [ “error:03000086:digital envelope routines::initialization error” ],
12:14:37 AM: library: “digital envelope routines”,
12:14:37 AM: reason: “unsupported”,
12:14:37 AM: code: “ERR_OSSL_EVP_UNSUPPORTED”
12:14:37 AM: }
12:14:37 AM: Node.js v18.18.0
12:14:37 AM: ​
12:14:37 AM: “build.command” failed
12:14:37 AM: ────────────────────────────────────────────────────────────────
12:14:37 AM: ​
12:14:37 AM: Error message
12:14:37 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
12:14:37 AM: ​
12:14:37 AM: Error location
12:14:37 AM: In Build command from Netlify app:
12:14:37 AM: npm run build
12:14:37 AM: ​
12:14:37 AM: Resolved config
12:14:37 AM: build:
12:14:37 AM: command: npm run build
12:14:37 AM: commandOrigin: ui
12:14:37 AM: publish: /opt/build/repo/build
12:14:37 AM: publishOrigin: ui
12:14:39 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:14:39 AM: Failing build: Failed to build site
12:14:39 AM: Finished processing build request in 36.617s
12:14:39 AM: Failed during stage “building site”: Build script returned non-zero exit code: 2

please help its making me sick right now

Hi @blackdream

Welcome to the community! :mirror_ball:

I would start by reviewing this thread:

We also have some support guides that might prove helpful: