vue【opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]】

vue【opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]】

一、Vue项目启动报错如下

> front@0.1.0 serve
> vue-cli-service serve

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
 INFO  Starting development server...
10% building 2/5 modules 3 active ...rontsHospital\front\node_modules\eslint-loader\index.js??ref--14-0!D:\Vue\front\src\main.js E
rror: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:68:19)
    at Object.createHash (node:crypto:138:10)
    at module.exports (D:\Vue\front\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at runSyncOrAsync (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
    at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
    at Array.<anonymous> (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\Vue\front\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\Vue\front\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
node:internal/crypto/hash:68
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^


Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:68:19)
    at Object.createHash (node:crypto:138:10)
    at module.exports (D:\Vue\front\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at D:\Vue\front\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at D:\Vue\front\node_modules\graceful-fs\graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',

Node.js v20.11.0

解决方式1:NodeJS版本过高

解决方式2:添加项目启动参数

在npm run serve项目启动前声明条件变量

//windows
$env:NODE_OPTIONS="--openssl-legacy-provider"
npm run serve

//Linux
NODE_OPTIONS=--openssl-legacy-provider npm run serve
PS D:\Vue\front> $env:NODE_OPTIONS="--openssl-legacy-provider"
PS D:\Vue\front> npm run serve                                
 DONE  Compiled successfully in 12694ms                                                                                                    15:30:15


  App running at:
  - Local:   http://localhost:8080/
  - Network: http://192.168.1.10:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

endl

  • 8
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

良辰美景好时光

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值