Hyperledger TypeError:类扩展未定义的值不是函数或null

时间:2019-10-10 10:49:22

标签: typescript hyperledger-fabric

尝试实例化Hyperledger Fabric的链码时遇到以下错误。

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/home/dev/Documents/drc-api/dist/src/hyperledger/models/document.js:4:32)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/dev/Documents/drc-api/dist/src/hyperledger/drcContract.js:4:20)
    at Module._compile (module.js:653:30)

我已经用Madge检查了循环依赖,但我认为这不是问题。

我正在使用VSCode中的IBM Blockchain Platform扩展来创建Hyperledger网络,以安装和实例化用于测试的链码。

  1. 其他信息:
    • 节点v8.16.1
    • NPM v6.11.3
    • Docker v19.03.2
    • Docker-compose v1.24.1
    • Ubuntu 18.04 LTS

这是它抱怨的文件。

drcContract.ts

import { Contract, Context } from 'fabric-contract-api';
import {Document} from './models/document'
import {Case} from './models/case'    
import {DocumentList} from './lists/documentList'    
import {CaseList} from './lists/caseList'    
import {Log, Action} from './models/log'    
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';

class DRCContext extends Context {
    /* functions */
}

export class DRCContract extends Contract {
    /* functions */
}
module.exports = DRCContract;

document.ts

import {State} from '../hyperledger-state/state';
import {Log} from './log';
import {Timestamp} from "google-protobuf/google/protobuf/timestamp_pb";

export class Document extends State {
    constructor() {
        super();
    }

    /* Getters & Setters */    
}    
export default Document;    
module.exports = Document;

drcContract.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fabric_contract_api_1 = require("fabric-contract-api");
const document_1 = require("./models/document");
const case_1 = require("./models/case");
const documentList_1 = require("./lists/documentList");
const caseList_1 = require("./lists/caseList");
const log_1 = require("./models/log");
const timestamp_pb_1 = require("google-protobuf/google/protobuf/timestamp_pb");
class DRCContext extends fabric_contract_api_1.Context {
    constructor() {
        super();
    }

    /* functions */
}
class DRCContract extends fabric_contract_api_1.Contract {
    constructor() {
        super();
    }

    /* functions */
}
exports.DRCContract = DRCContract;
module.exports = DRCContract;

document.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const state_1 = require("../hyperledger-state/state");
class Document extends state_1.State {
    constructor() {
        super();
    }
    /* Getters & Setters */
}
exports.Document = Document;
exports.default = Document;
module.exports = Document;

0 个答案:

没有答案