简体   繁体   English

无法找到在 Fabcar 示例中注册管理员所需的模块 - Hyperledger Fabric

[英]Unable to find modules required to enroll admin in Fabcar example - Hyperledger fabric

I am pretty new to Hyperledger fabric and StackOverflow as well.我对 Hyperledger Fabric 和 StackOverflow 也很陌生。 I was trying to experiment with the fabcar example - https://hyperledger-fabric.readthedocs.io/en/release-1.4/write_first_app.html on Hyperledger.我试图在 Hyperledger 上尝试 fabcar 示例 - https://hyperledger-fabric.readthedocs.io/en/release-1.4/write_first_app.html However, I am unable to proceed with enrolling the Admin.但是,我无法继续注册管理员。

After issuing发出后

npm install
node enrollAdmin.js

in the fabcar/javascript directory, I am hitting the error在 fabcar/javascript 目录中,我遇到了错误

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module './utils.js'
Require stack:
- /b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/lib/FabricCAServices.js
- /b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/index.js
- /b/workspace/fabric-samples/fabcar/javascript/enrollAdmin.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/lib/FabricCAServices.js:10:15)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/lib/FabricCAServices.js',
    '/b/workspace/fabric-samples/fabcar/javascript/node_modules/fabric-ca-client/index.js',
    '/b/workspace/fabric-samples/fabcar/javascript/enrollAdmin.js'
  ]
}

I'm not sure if this is some single sourcing problem between the fabric client and the fabric-ca-client.我不确定这是否是 Fabric 客户端和 Fabric-ca-client 之间的单一采购问题。 I have tried uninstalling and reinstalling nodejs and npm.我尝试卸载并重新安装 nodejs 和 npm。 I have also tried pruning all the docker images, networks, volumes and start from scratch.我还尝试修剪所有 docker 图像、网络、卷并从头开始。

Here's the package.json for reference:这是 package.json 供参考:

{
    "name": "fabcar",
    "version": "1.0.0",
    "description": "FabCar application implemented in JavaScript",
    "engines": {
        "node": ">=8",
        "npm": ">=5"
    },
    "scripts": {
        "lint": "eslint .",
        "pretest": "npm run lint",
        "test": "nyc mocha --recursive"
    },
    "engineStrict": true,
    "author": "Hyperledger",
    "license": "Apache-2.0",
    "dependencies": {
        "fabric-ca-client": "~1.4.0",
        "fabric-network": "~1.4.0"
    },
    "devDependencies": {
        "chai": "^4.2.0",
        "eslint": "^5.9.0",
        "mocha": "^5.2.0",
        "nyc": "^13.1.0",
        "sinon": "^7.1.1",
        "sinon-chai": "^3.3.0"
    },
    "nyc": {
        "exclude": [
            "coverage/**",
            "test/**"
        ],
        "reporter": [
            "text-summary",
            "html"
        ],
        "all": true,
        "check-coverage": true,
        "statements": 100,
        "branches": 100,
        "functions": 100,
        "lines": 100
    }
}

Can someone please help me find out what I might be missing here?有人可以帮我找出我在这里可能缺少的东西吗?

Environment details:环境细节:

Ubuntu on Windows Subsystem for Linux适用于 Linux 的 Windows 子系统上的 Ubuntu

Node js version: v12.16.1节点js版本:v12.16.1

npm version: 6.13.4 npm 版本:6.13.4

Docker compose version: docker-compose version 1.22.0, build f46880fe Docker compose 版本:docker-compose 版本 1.22.0,构建 f46880fe

Docker version: Docker version 19.03.6, build 369ce74a3c Docker 版本:Docker 版本 19.03.6,构建 369ce74a3c

Fabric binaries: 1.4.0织物二进制文件:1.4.0

There are some issues with the new "fabric-ca-client" package.Some minor updates changed the dependencies.新的“fabric-ca-client”包存在一些问题。一些小的更新改变了依赖关系。 So, The working version is: "fabric-ca-client": "1.4.0"所以,工作版本是: "fabric-ca-client": "1.4.0"

I removed the tilde(~) to download the exact version.Rest of the dependencies and their versions are same.我删除了波浪号(~)以下载确切版本。其余的依赖项及其版本相同。

I had also faced this issue.我也遇到过这个问题。 And now I'm following this process to resolve.现在我正在按照这个过程来解决。

step:1 Check a fabric local version.I'm using 1.4.6.步骤:1检查结构本地版本。我使用的是 1.4.6。

command:命令:

curl https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s -- 1.4.6 1.4.6 0.4.18

step:2第2步

cd fabric-samples/first-networks

step:3 To check this version is working or not.步骤:3检查此版本是否有效。

./byfn.sh generate

step:4第四步

 ./byfn.sh up

step:5 Now down the network.步骤:5现在关闭网络。

 ./byfn.sh down

After checking all the above process you can start fabcar project.检查完以上所有过程后,您就可以启动fabcar项目了。

I successfully import my admin and user1 identity.我成功导入了我的adminuser1身份。

Hope it will help you:)希望能帮到你:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM