当前位置: 首页> 健康> 美食 > 石家庄seo外包的公司_简单工程承包合同范本_百度客服中心_南宁网络优化seo费用

石家庄seo外包的公司_简单工程承包合同范本_百度客服中心_南宁网络优化seo费用

时间:2025/8/8 9:26:54来源:https://blog.csdn.net/m0_38072683/article/details/146229763 浏览次数:2次
石家庄seo外包的公司_简单工程承包合同范本_百度客服中心_南宁网络优化seo费用

问题描述

最近,在启动一个遗留前端(Vue)项目时,遇到了error:0308010C:digital envelope routines::unsupported错误。

95% emitting CompressionPlugin ERROR  Error: error:0308010C:digital envelope routines::unsupported
Error: error:0308010C:digital envelope routines::unsupportedat new Hash (node:internal/crypto/hash:79:19)at Object.createHash (node:crypto:139:10)at D:\code\front\shucheng-admin-ui\node_modules\compression-webpack-plugin\dist\index.js:243:42    at CompressionPlugin.compress (D:\code\front\shucheng-admin-ui\node_modules\compression-webpack-plugin\dist\index.js:284:9)at D:\code\front\shucheng-admin-ui\node_modules\compression-webpack-plugin\dist\index.js:305:12    at _next1 (eval at create (D:\code\front\shucheng-admin-ui\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:14:17)at eval (eval at create (D:\code\front\shucheng-admin-ui\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:33:1)at D:\code\front\shucheng-admin-ui\node_modules\copy-webpack-plugin\dist\index.js:91:9

这是因为Node.js v17 及以上版本默认使用 OpenSSL 3.x,而 OpenSSL 3.x 移除了对一些旧加密算法的支持。因此,依赖这些旧算法的模块(如CompressionPlugin)在运行时可能会抛出 error:0308010C:digital envelope routines::unsupported 错误。

解决方案(TL;DR)

方案一:使用 OpenSSL 旧版提供程序

通过在启动命令中设置 NODE_OPTIONS=--openssl-legacy-provider,强制 Node.js 使用旧版的 OpenSSL 提供程序,从而支持被移除的旧算法。

具体操作
Windows 系统:

"scripts": {"dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve","build:prod": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build","build:stage": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode staging"
}

Unix/Linux/Mac 系统:

"scripts": {"dev": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve","build:prod": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build","build:stage": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build --mode staging"
}

方案二:降级 Node.js 版本

如果您不需要 Node.js v17 及以上版本的新功能,可以考虑降级到 Node.js v16 或更早的版本。这些版本默认使用 OpenSSL 1.x,通常不会遇到该问题。

方案三:更新相关依赖

检查是否有更新版本的 CompressionPlugin 或其他依赖库,新版本可能已经兼容 OpenSSL 3.x。

关键字:石家庄seo外包的公司_简单工程承包合同范本_百度客服中心_南宁网络优化seo费用

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: