簡體   English   中英

超級賬本 Aries 上出現錯誤“找不到指定的模塊”

[英]Error "The specified module could not be found" on hyperledger Aries

在完成https://aries.js.org/guides/getting-started/set-up中的所有操作后,我正在嘗試復制粘貼此代碼以初始化代理

//imports for indy-sdk
import type { InitConfig } from '@aries-framework/core'
import { Agent } from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/node'
import { HttpOutboundTransport, WsOutboundTransport } from '@aries-framework/core'
import { HttpInboundTransport } from '@aries-framework/node'
// The agent initialization configuration

const config: InitConfig = {
    label: 'docs-nodejs-agent',
    walletConfig: {
        id: 'wallet-id',
        key: 'testkey0000000000000000000000000',
    },
}
// Creating an agent instance
const agent = new Agent(config, agentDependencies)
// Registering the required in- and outbound transports

agent.registerOutboundTransport(new HttpOutboundTransport())
agent.registerInboundTransport(new HttpInboundTransport({ port: 3000 }))
// Function to initialize the agent
const initialize = async () => await agent.initialize().catch(console.error)

但是在 visual studio 2022 上,它給了我這個錯誤:

C:\Users\Tosat\Desktop\Ladon\LadonHyperledgerAries\node_modules\bindings\bindings.js:121
        throw e;
        ^

Error: The specified module could not be found.
\\?\C:\Users\Tosat\Desktop\Ladon\LadonHyperledgerAries\node_modules\indy-sdk\build\Release\indynodejs.node
    at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at bindings (C:\Users\Tosat\Desktop\Ladon\LadonHyperledgerAries\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (C:\Users\Tosat\Desktop\Ladon\LadonHyperledgerAries\node_modules\indy-sdk\src\indyBinding.js:1:37)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v19.0.1

問題是位於 C:\Users\Tosat\Desktop\Ladon\LadonHyperledgerAries\node_modules\indy-sdk\build\Release\indynodejs.node 的文件存在並且是正確的......提前致謝!

我遇到了同樣的問題,我想我至少找到了 windows 的解決方案,所以我希望你也在 windows 上,否則我認為這不會對你有很大幫助。

第一步是:在https 下載 indy-sdk 的預構建庫://repo.sovrin.org/windows/libindy/master/1.16.0-1636/libindy_1.16.0.ziphttps://aries所述.js.org/guides/getting-started/installation/nodejs/windows

第二步是:將這些解壓縮到文件夾中的某個位置

第三步是:在您的環境變量>系統變量中設置這些庫,如上面鏈接的文檔中所述 LD_LIBRARY_PATH 並確保該值指向您解壓預構建庫的 /lib 文件夾

我在上面執行了這些步驟,但仍然遇到了您遇到的問題,並且我在某處發現提到 indy-sdk 需要系統路徑https://www.npmjs.com/package/indy-sdk中的 libindy。 所以我也正是這樣做的。

所以第四步是:Select Path 在你的System variables 下點擊Edit。 然后單擊新建並粘貼您提取的 /lib 的位置,以便與 LD_LIBRARY_PATH 具有相同的值。

第五步不要忘記重新啟動並使用 yarn add... 重新安裝依賴項,如設置https://aries.js.org/guides/getting-started/set-up中所述。 這可能是至關重要的,因為在完成所有這些之后需要重新啟動才能工作

如果這對您有用,請告訴我!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM