CHINER 元数建模工具升级到 v4.0 版本后更名为 PDManer。
打包
首先安装 Node.js 和 Yarn,具体可以参考 How to install Node.js via binary archive on Linux 和 Yarn 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
经过查询得知,这是因为不支持旧版本加密套件导致的,需要开启旧版支持。
在 Linux 上执行
export NODE_OPTIONS=--openssl-legacy-provider
在 Windows 上执行
set NODE_OPTIONS=--openssl-legacy-provider
在 PowerShell 上执行
$env:NODE_OPTIONS = "--openssl-legacy-provider"
配置环境变量后重新执行构建即可。
附录
参考链接
本文由 柒 创作,采用 知识共享署名4.0
国际许可协议进行许可。
转载本站文章前请注明出处,文章作者保留所有权限。
最后编辑时间: 2023-01-28 11:27 AM