这个错误通常与Node.js的加密模块和OpenSSL版本有关
出现这个错误是因为 node.js V17版本中最近发布的OpenSSL3.0, 而OpenSSL3.0对允许算法和密钥大小增加了严格的限制,可能会对生态系统造成一些影响.
js/app.8d066b51.js from Terser Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:79:19) at Object.createHash (node:crypto:139:10) at D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\terser-webpack-plugin\dist\index.js:217:37 at Array.forEach (<anonymous>) at TerserPlugin.optimizeFn (D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\terser-webpack-plugin\dist\index.js:160:259) at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1) at AsyncSeriesHook.lazyCompileHook (D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20) at D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\webpack\lib\Compilation.js:1409:36 at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1) at AsyncSeriesHook.lazyCompileHook (D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20) at D:\Projects\15.ithoth\01.SourceCode\Web\branches\V1.0.13\node_modules\webpack\lib\Compilation.js:1405:32
解决方案
如果CMD 发布,则在 Windows系统 增加环境变更
set NODE_OPTIONS=--openssl-legacy-provider