Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1092|回复: 0
打印 上一主题 下一主题

uos vue nodejs报digital envelope routines::unsupported错误的最新解决方法

[复制链接]

1272

主题

2067

帖子

7962

积分

认证用户组

Rank: 5Rank: 5

积分
7962
跳转到指定楼层
楼主
发表于 2023-12-19 14:02:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
https://www.jb51.net/article/276245.htm

这两天准备在github上找一个vue3的后台框架学习一下,后来找到一个vue-admin-better这个VUE3开发后台框架,感觉不错,准备安装了跑起来看一看效果

就运行

[size=1em]
[size=1em]1

[size=1em][size=1em]npm run serve




结果就报一堆错误

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at runSyncOrAsync (D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
    at iterateNormalLoaders (D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
    at Array.<anonymous> (D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\home\project\demo\vue-admin-better\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\home\project\demo\vue-admin-better\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
10% building 2/5 modules 3 active ...dmin-better\node_modules\eslint-loader\index.js??ref--14-0!D:\home\project\demo\vue-admin-better\src\main.jsnode:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\home\project\demo\vue-admin-better\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (D:\home\project\demo\vue-admin-better\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\home\project\demo\vue-admin-better\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\home\project\demo\vue-admin-better\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at D:\home\project\demo\vue-admin-better\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'
}

Baidu 了一下发现是 Node JS 17 的 BUG,相关 ISSUE 也给出了解决办法,就是修改package.json,在相关构建命令之前加入set NODE_OPTIONS=–openssl-legacy-provider

[size=1em]
[size=1em]1

[size=1em]2

[size=1em]3

[size=1em]4

[size=1em][size=1em]"scripts": {
[size=1em]    "serve": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service serve",
[size=1em]    "build": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build",
[size=1em]    "build:report": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build --report",




如果是 Linux 或者 WSL 环境,请加入

[size=1em]
[size=1em]1

[size=1em][size=1em]export NODE_OPTIONS=--openssl-legacy-provider




如果是windows ,我的电脑上右键–>属性—>高级系统设置

保存后windows需要重启一下电脑

然后就可以运行npm打包命令不会报错了

到此这篇关于解决nodejs报digital envelope routines::unsupported错误的方法的文章就介绍到这了


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-11-25 10:13 , Processed in 0.062598 second(s), 20 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表