导航菜单
登录 注册

更新 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",

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

export NODE_OPTIONS=--openssl-legacy-provider
Typecho根据文章cid与字段名获取字段值
上一篇
Typecho 限制字数输出摘要
下一篇
广告