(undefined) assets/js/styles.f419522a.js from Terser
Error: error:0308010C:digital envelope routines::unsupported
在使用 GitHub active 自动化部署的时候,运行打包会报这个错,是因为 node.js V17 版本中最近发布的OpenSSL3.0, 而 OpenSSL3.0 对允许算法和密钥大小增加了严格的限制
我使用的是node18以上的版本,因为我要使用 GitHub Actions 来实现博客的自动化部署,所以运行打包的命令我是写在 sh 文件里面的,在网上找到的一些方法是要在 package.json
文件里面对应命令加上 export NODE_OPTIONS=--openssl-legacy-provider
如:
"build": "set NODE_OPTIONS=--openssl-legacy-provider & vuepress build docs"
但并不能解决我的问题 〒▽〒 流下来没技术的泪水.jpg
报错原因找到了,那就只能是 node 版本问题了,但又必须使用 18 以上的版本·烦·
后来试着在 deploy 命令中加入上面的代码,竟然可行!
配置如下:
"deploy": "NODE_OPTIONS=--openssl-legacy-provider bash deploy.sh"
至此,完美解决这个问题 ~