1.error
# npm run dev:buyer
> privateinvoice@0.0.1 dev:buyer
> npx dotenv -e .buyer.env node index.js
:
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:133:10)
at hash160 (/opt/PrivateInvoice1/520r/node_modules/hdkey/lib/hdkey.js:242:17)
at HDKey.set (/opt/PrivateInvoice1/520r/node_modules/hdkey/lib/hdkey.js:39:24)
at HDKey.fromMasterSeed (/opt/PrivateInvoice1/520r/node_modules/hdkey/lib/hdkey.js:187:20)
at _callee$ (/opt/PrivateInvoice1/520r/node_modules/@sidetree/crypto/dist/crypto.cjs.development.js:869:26)
at tryCatch (/opt/PrivateInvoice1/520r/node_modules/@sidetree/crypto/dist/crypto.cjs.development.js:132:40)
at Generator.invoke [as _invoke] (/opt/PrivateInvoice1/520r/node_modules/@sidetree/crypto/dist/crypto.cjs.development.js:363:22)
at Generator.next (/opt/PrivateInvoice1/520r/node_modules/@sidetree/crypto/dist/crypto.cjs.development.js:188:21)
at asyncGeneratorStep (/opt/PrivateInvoice1/520r/node_modules/@sidetree/crypto/dist/crypto.cjs.development.js:14:24)
at _next (/opt/PrivateInvoice1/520r/node_modules/@sidetree/crypto/dist/crypto.cjs.development.js:36:9) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.2.0
#
2.対策
・package.jsonのscriptsに以下を追加する
NODE_OPTIONS=–openssl-legacy-provider
3.package.jsonの修正
(1) 変更前
"scripts": {
"dev:seller": "npx dotenv -e .seller.env node index.js",
"dev:buyer": "npx dotenv -e .buyer.env node index.js",
},
(2) 変更後
"scripts": {
"dev:seller": "NODE_OPTIONS=--openssl-legacy-provider npx dotenv -e .seller.env node index.js",
"dev:buyer": "NODE_OPTIONS=--openssl-legacy-provider npx dotenv -e .buyer.env node index.js",
},