更新 XMLiving 的主题发现无法构建 JS/CSS,报如下错误
PS E:\WorkSpace\development\wwwroot\usr\themes\XMLiving> npm run build
> xmliving@2.1.0 build
> webpack --config ./webpack/webpack.build.js
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at BulkUpdateDecorator.hashFactory (E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\lib\util\createHash.js:145:18)
at BulkUpdateDecorator.update (E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\lib\util\createHash.js:46:50)
at OriginalSource.updateHash (E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\node_modules\webpack-sources\lib\OriginalSource.js:104:8)
at NormalModule._initBuildHash (E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\lib\NormalModule.js:868:17)
at handleParseResult (E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\lib\NormalModule.js:934:10)
at E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\lib\NormalModule.js:1026:4
at processResult (E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\lib\NormalModule.js:743:11)
at E:\WorkSpace\development\wwwroot\usr\themes\XMLiving\node_modules\webpack\lib\NormalModule.js:807:5
Google 了一下发现是 Node JS 17 的 BUG,相关 ISSUE 也给出了解决办法,就是修改package.json
,在相关构建命令之前加入set NODE_OPTIONS=--openssl-legacy-provider
"build": "set NODE_OPTIONS=--openssl-legacy-provider & webpack --config ./webpack/webpack.build.js",
export NODE_OPTIONS=--openssl-legacy-provider
精选留言