Odyssey Lift Off - Part 1 Fails to build client in Node 17

As of commit 8299f344e5df363a1880ba138b3c1af027610449 when using Node 17, the following error is thrown when running npm run build or npm start in the /client directory. Using Node 16 works.

ā–¶ npm run build

> catstronauts-client@1.0.0 build
> react-scripts build

Creating an optimized production build...
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at runSyncOrAsync (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at iterateNormalLoaders (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/react-scripts/scripts/build.js:19
  throw err;
  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/NormalModule.js:417:16)
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/NormalModule.js:452:10
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/webpack/lib/NormalModule.js:323:13
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /Users/shanemyrick/src/local/odyssey/odyssey-lift-off-part1/client/node_modules/babel-loader/lib/index.js:59:103 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.2.0

For those looking for a fix set the following environment variable in the terminal

export NODE_OPTIONS=--openssl-legacy-provider

https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

1 Like