AdSense

網頁

2024/3/21

React 啟動錯誤 error:0308010C:digital envelope routines::unsupported

React啟動時發生錯誤error:0308010C:digital envelope routines::unsupported


錯誤

% npm start

> app@0.1.0 start
> set NODE_OPTIONS=--openssl-legacy-provider && react-scripts start

ℹ 「wds」: Project is running at http://192.168.101.103/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /../react-demo/app/public
ℹ 「wds」: 404s will fallback to /
Starting the development server...

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:80:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (/../react-demo/app/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/../react-demo/app/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/../react-demo/app/node_modules/webpack/lib/NormalModule.js:471:10)
    at /../react-demo/app/node_modules/webpack/lib/NormalModule.js:503:5
    at /../react-demo/app/node_modules/webpack/lib/NormalModule.js:358:12
    at /../react-demo/app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/../react-demo/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/../react-demo/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
/../react-demo/app/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

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

Node.js v21.7.1


解決

問題出在使用的Node.js版本太新了,為v21.7.1。降回v16.20.2即可正常啟動。


沒有留言:

AdSense