Building for production...Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/export/home/cms/git/eb-chain/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:471:10)
at /export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:503:5
at /export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:358:12
at /export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at runSyncOrAsync (/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at Array.<anonymous> (/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/export/home/cms/git/eb-chain/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /export/home/cms/git/eb-chain/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:114
throw e;
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/export/home/cms/git/eb-chain/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:471:10)
at /export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:503:5
at /export/home/cms/git/eb-chain/node_modules/webpack/lib/NormalModule.js:358:12
at /export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at /export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:186:6
at context.callback (/export/home/cms/git/eb-chain/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /export/home/cms/git/eb-chain/node_modules/cache-loader/dist/index.js:240:7
at /export/home/cms/git/eb-chain/node_modules/neo-async/async.js:2830:7
at done (/export/home/cms/git/eb-chain/node_modules/neo-async/async.js:2865:11)
at /export/home/cms/git/eb-chain/node_modules/neo-async/async.js:2818:7
at Array.<anonymous> (/export/home/cms/git/eb-chain/node_modules/cache-loader/dist/index.js:229:9) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v17.3.0
今天服务器更新项目时遇到这个问题,目测是说版本不兼容 node.js V17版本中最近发布的OpenSSL3.0, 而OpenSSL3.0对允许算法和密钥大小增加了严格的限制,可能会对生态系统造成一些影响,node在17版本下就会报这个错误。直接执行export NODE_OPTIONS=--openssl-legacy-provider 改变一下参数可以运行成功