打包 Node.js 时报错 digital envelope routines::unsupported 问题
后知后觉 暂无评论

CHINER 元数建模工具升级到 v4.0 版本后更名为 PDManer。

打包

首先安装 Node.js 和 Yarn,具体可以参考 How to install Node.js via binary archive on LinuxYarn Installation

安装完毕后克隆源码并进行构建

git clone -b v4.3.0 https://gitee.com/robergroup/pdmaner.git
cd pdmaner/
yarn --registry=https://registry.npm.taobao.org
yarn package-linux
注意:如果在非中国大陆地区,不用添加 --registry=... 参数。

错误

在尝试打包 PDManer 时遇到以下报错:

node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/kane/Downloads/pdmaner/.yarn/__virtual__/webpack-virtual-27e0b006ff/0/cache/webpack-npm-4.38.0-bd60692d08-ec465c7402.zip/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/kane/Downloads/pdmaner/.yarn/__virtual__/webpack-virtual-27e0b006ff/0/cache/webpack-npm-4.38.0-bd60692d08-ec465c7402.zip/node_modules/webpack/lib/NormalModule.js:412:16)
    at handleParseError (/home/kane/Downloads/pdmaner/.yarn/__virtual__/webpack-virtual-27e0b006ff/0/cache/webpack-npm-4.38.0-bd60692d08-ec465c7402.zip/node_modules/webpack/lib/NormalModule.js:463:10)
    at /home/kane/Downloads/pdmaner/.yarn/__virtual__/webpack-virtual-27e0b006ff/0/cache/webpack-npm-4.38.0-bd60692d08-ec465c7402.zip/node_modules/webpack/lib/NormalModule.js:495:5
    at /home/kane/Downloads/pdmaner/.yarn/__virtual__/webpack-virtual-27e0b006ff/0/cache/webpack-npm-4.38.0-bd60692d08-ec465c7402.zip/node_modules/webpack/lib/NormalModule.js:354:12
    at /home/kane/Downloads/pdmaner/.yarn/cache/loader-runner-npm-2.4.0-c414104c2f-e27eebbca5.zip/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/kane/Downloads/pdmaner/.yarn/cache/loader-runner-npm-2.4.0-c414104c2f-e27eebbca5.zip/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/home/kane/Downloads/pdmaner/.yarn/cache/loader-runner-npm-2.4.0-c414104c2f-e27eebbca5.zip/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/kane/Downloads/pdmaner/.yarn/cache/enhanced-resolve-npm-4.5.0-1bcc7900d2-4d87488584.zip/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /home/kane/Downloads/pdmaner/.yarn/cache/enhanced-resolve-npm-4.5.0-1bcc7900d2-4d87488584.zip/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /home/kane/Downloads/pdmaner/.yarn/cache/graceful-fs-npm-4.2.10-79c70989ca-3f109d70ae.zip/node_modules/graceful-fs/graceful-fs.js:123:16
    at /home/kane/Downloads/pdmaner/.pnp.cjs:21046:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.13.0

经过查询得知,这是因为不支持旧版本加密套件导致的,需要开启旧版支持。

配置环境变量后重新执行构建即可。


附录

参考链接

本文撰写于一年前,如出现图片失效或有任何问题,请在下方留言。博主看到后将及时修正,谢谢!
禁用 / 当前已拒绝评论,仅可查看「历史评论」。