【问题标题】:Error: error:0308010C:digital envelope routines::unsupported - Next.js [duplicate]错误:错误:0308010C:数字信封例程::不支持 - Next.js [重复]
【发布时间】:2023-03-12 23:32:02
【问题描述】:

这个问题出现在 Node 17 版本的 Next.js 项目中,我尝试了很多解决方案,但这个解决方案是最好的,如果它发生在你身上,你可以解决这个问题


> landing-page@0.0.1 dev
> next dev

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
ready - started server on http://localhost:3000
node:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

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 (E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing Page, Business Website, Portfolio\nextjs_landing_page\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing 
Page, Business Website, Portfolio\nextjs_landing_page\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing Page, Business Website, Portfolio\nextjs_landing_page\node_modules\webpack\lib\NormalModule.js:471:10)
    at E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing Page, Business Website, Portfolio\nextjs_landing_page\node_modules\webpack\lib\NormalModule.js:503:5
    at E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing Page, Business Website, Portfolio\nextjs_landing_page\node_modules\webpack\lib\NormalModule.js:358:12
    at E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing Page, Business Website, Portfolio\nextjs_landing_page\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing Page, B    at Array.<anonymous> (E:\Collage\COURSES\react.js projects2\01.Build and Deploy a Premium Next JS React Website _ Landing Page, Business Website, Portfolio\nextjs_landing_page\node_modules\loader-runner\lib\LoaderRunner.js:205:4) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v17.2.0

【问题讨论】:

标签: node.js reactjs next.js node-modules


【解决方案1】:

首先,安装 cross-env

npx install cross-env

然后,只需在 package.json 中的脚本中设置它

"dev": "cross-env NODE_OPTIONS='--openssl-legacy-provider' next dev",

上次运行此命令

npm run dev

【讨论】:

猜你喜欢
  • 2021-12-10
  • 2021-12-31
  • 2022-06-22
  • 1970-01-01
  • 2022-09-30
  • 2021-12-08
  • 1970-01-01
  • 2022-10-24
相关资源
最近更新 更多