Repository: create-react-app
Issue: react-scripts fails to build project with Node 17
Labels: needs triage,issue: bug report

<!--
    Please note that your issue will be fixed much faster if you spend about
    half an hour preparing it, including the exact reproduction steps and a demo.

    If you're in a hurry or don't feel confident, it's fine to report bugs with
    less details, but this makes it less likely they'll get fixed soon.

    In either case, please use this template and fill in as many fields below as you can.

    Note that we don't provide help for webpack questions after ejecting.
    You can find webpack docs at https://webpack.js.org/.
-->

### Describe the bug

we have a CRA app, it used to build with Node 14.x very fine, today I upgrade nodejs to 17.0.0 and it failed. (in both my local machine and the CI-CD machine)

And these were the logs:
```
> 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 (/my-project/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/my-project/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/my-project/node_modules/webpack/lib/NormalModule.js:471:10)
    at /my-project/node_modules/webpack/lib/NormalModule.js:503:5
    at /my-project/node_modules/webpack/lib/NormalModule.js:358:12
    at /my-project/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/my-project/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/my-project/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /my-project/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at runSyncOrAsync (/my-project/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at iterateNormalLoaders (/my-project/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/my-project/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/my-project/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /my-project/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
/my-project/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 (/my-project/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/my-project/node_modules/webpack/lib/NormalModule.js:417:16)
    at /my-project/node_modules/webpack/lib/NormalModule.js:452:10
    at /my-project/node_modules/webpack/lib/NormalModule.js:323:13
    at /my-project/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /my-project/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/my-project/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /my-project/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.0.0
ERROR: Job failed: exit status 1
```

### Did you try recovering your dependencies?

<!--
  Your module tree might be corrupted, and that might be causing the issues.
  Let's try to recover it. First, delete these files and folders in your project:

    * node_modules
    * package-lock.json
    * yarn.lock

  Then you need to decide which package manager you prefer to use.
  We support both npm (https://npmjs.com) and yarn (https://yarnpkg.com/).
  However, **they can't be used together in one project** so you need to pick one.

  If you decided to use npm, run this in your project directory:

    npm install -g npm@latest
    npm install

  This should fix your project.

  If you decided to use yarn, update it first (https://yarnpkg.com/en/docs/install).
  Then run in your project directory:

    yarn

  This should fix your project.

  Importantly, **if you decided to use yarn, you should never run `npm install` in the project**.
  For example, yarn users should run `yarn add <library>` instead of `npm install <library>`.
  Otherwise your project will break again.

  Have you done all these steps and still see the issue?
  Please paste the output of `npm --version` and/or `yarn --version` to confirm.
-->

yes. in both local machine and CI-CD machine I re-installed all the dependencies

### Which terms did you search for in User Guide?

<!--
  There are a few common documented problems, such as watcher not detecting changes, or build failing.
  They are described in the Troubleshooting section of the User Guide:

  https://facebook.github.io/create-react-app/docs/troubleshooting

  Please scan these few sections for common problems.
  Additionally, you can search the User Guide itself for something you're having issues with:

  https://facebook.github.io/create-react-app/

  If you didn't find the solution, please share which words you searched for.
  This helps us improve documentation for future readers who might encounter the same problem.
-->

I searched Google for `error:0308010C:digital envelope routines::unsupported` with and without the `0308010C` part

### Environment

<!--
  To help identify if a problem is specific to a platform, browser, or module version, information about your environment is required.
  This enables the maintainers quickly reproduce the issue and give feedback.

  Run the following command in your React app's folder in terminal.
  Note: The result is copied to your clipboard directly.

  `npx create-react-app --info`

  Paste the output of the command in the section below.
-->

```
current version of create-react-app: 4.0.3
  running from /home/.npm/_npx/34113/lib/node_modules/create-react-app

  System:
    OS: Linux 5.13 Ubuntu 21.10 21.10 (Impish Indri)
    CPU: (4) x64 Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz
  Binaries:
    Node: 17.0.0 - /usr/bin/node
    Yarn: Not Found
    npm: 8.1.0 - /usr/bin/npm
  Browsers:
    Chrome: 95.0.4638.54
    Firefox: 93.0
  npmPackages:
    react: ^16.13.1 => 16.13.1 
    react-dom: ^16.13.1 => 16.13.1 
    react-scripts: ^4.0.3 => 4.0.3 
  npmGlobalPackages:
    create-react-app: Not Found
```

### Steps to reproduce

<!--
  How would you describe your issue to someone who doesn’t know you or your project?
  Try to write a sequence of steps that anybody can repeat to see the issue.
-->

(Write your steps here:)

1. create new react app with create-react-app and node 14
2. do `npm run build` to see it builds completely fine
3. upgrade to node 17 and do `npm run build` again to see it fail

### Expected behavior

<!--
  How did you expect the tool to behave?
  It’s fine if you’re not sure your understanding is correct.
  Just write down what you thought would happen.
-->

to build flawlessly

### Actual behavior

<!--
  Did something go wrong?
  Is something broken, or not behaving as you expected?
  Please attach screenshots if possible! They are extremely helpful for diagnosing issues.
-->

The build failed with errors printed above!

<!--
  What happens if you skip this step?

  We will try to help you, but in many cases it is impossible because crucial
  information is missing. In that case we'll tag an issue as having a low priority,
  and eventually close it if there is no clear direction.

  We still appreciate the report though, as eventually somebody else might
  create a reproducible example for it.

  Thanks for helping us help you!
-->

# Note

I know that it is mostly not related to create-react-app, but another package, maybe webpack or it's dependencies. But as I cannot dig down, I write this issue here so the professionals can track it further.

Thanks