使用ng serve -o
成功构建Angular应用程序
但是在Chrome控制台中出现错误。
我什至不必调用该方法,它在调用任何东西之前就中断了。
它在makeTransaction()
函数中中断。
Uncaught TypeError: Cannot read property 'prototype' of undefined
at inherits (inherits_browser.js:5)
at Object.../../../../../../node_modules/hash-base/index.js (index.js:23)
at __webpack_require__ (bootstrap:78)
at Object.../../../../../../node_modules/md5.js/index.js (index.js:3)
at __webpack_require__ (bootstrap:78)
at Object.../../../../../../node_modules/create-hash/browser.js (browser.js:3)
at __webpack_require__ (bootstrap:78)
at Object.../../../../../../node_modules/bitcoinjs-lib/node_modules/bip32/src/crypto.js (crypto.js:3)
at __webpack_require__ (bootstrap:78)
at Object.../../../../../../node_modules/bitcoinjs-lib/node_modules/bip32/src/bip32.js (bip32.js:3)
我尝试删除node-modules文件夹并运行> npm install, 我尝试将包装文件导入app.module.ts文件,但出现另一个错误。
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import * as bitcoin from 'bitcoinjs-lib';
@Injectable({
providedIn: 'root'
})
export class DataService {
constructor(private http: HttpClient, private network: any) {
network = bitcoin.networks.testnet;
}
// Make transaction
makeTransaction() {
// Network specification
const test = this.network;
}