当前位置:   article > 正文

VUE 03000086:digital envelope routines::initialization error&0308010C:digital envelope routines_vue digital envelope routines::initialization erro

vue digital envelope routines::initialization error

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

npm run electron:serve
  • 1

时遇到问题:


-  Bundling main process...node:internal/crypto/hash:69
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:471:10)
    at F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:503:5
    at F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:358:12
    at F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at F:\vue\electron\electron-demo\node_modules\vue-cli-plugin-electron-builder\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at F:\vue\electron\electron-demo\node_modules\graceful-fs\graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

本人node.js版本v18.17.1
参考博客:https://blog.csdn.net/zjjxxh/article/details/127173968Vue 报错error:0308010C:digital envelope routines::unsupported

和博客不同的时,我在执行 npm run serve时是没有问题的,但执行 npm run electron: serve时出错。

方案1:在Windows的console中输入

参考博客方法1,在Windows的console中输入了:

set NODE_OPTIONS=--openssl-legacy-provider
  • 1

之后执行

F:\vue\electron\electron-demo> npm run electron:serve

> electron-demo@0.1.0 electron:serve
> vue-cli-service electron:serve

 INFO  Starting development server...


 DONE  Compiled successfully in 4337ms                                                                          09:45:15


  App running at:
  - Local:   http://localhost:8081/
  - Network: http://10.110.99.82:8081/

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

\  Bundling main process...

 DONE  Compiled successfully in 1273ms                                                                          09:45:17

  File                      Size                                         Gzipped

  dist_electron\index.js    806.56 KiB                                   177.59 KiB

  Images and other types of assets omitted.
  Build at: 2023-08-29T01:45:17.491Z - Hash: 2ce3714cb60e42882f09 - Time: 1273ms

 INFO  Launching Electron...
electron: --openssl-legacy-provider is not allowed in NODE_OPTIONS
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

是因为你的 NODE_OPTIONS 环境变量中包含了 --openssl-legacy-provider 选项,而这个选项在当前版本的 Node.js v18.17.1中被禁用了。
遇到错误

electron: --openssl-legacy-provider is not allowed in NODE_OPTIONS
参考博客:https://blog.csdn.net/zhu_liu_kun/article/details/130840151
之后又遇到了03000086的问题

方案2:卸载Node.js17+版本,安装Node.js17-版本

  1. 卸载:控制面板

  2. nodejsv16.20.2下载网址: https://nodejs.org/download/release/v16.20.2/

  3. 下载版本node-v16.20.2-x64.msi

  4. 运行 npm run electron:serve 
    
    • 1
  5. 成功

在这里插入图片描述

总结

进入了问题循环,通过重新安装node.js解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/611597
推荐阅读
相关标签
  

闽ICP备14008679号