简体   繁体   中英

Nano Ledger S in Angular

Today I ran into a problem while trying to connect my NANO Ledger S to my angular app.

I've tried installing this package yet it does not seem to work due to the package throwing some errors.

Module '"events"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

This can be fixed by putting changing the EventEmmiter import to

import {EventEmitter} from "events";

Now at least the app compiles, but when I to access the Devices over the TransportWebUSB class a "ERROR Error: Uncaught (in promise): ReferenceError: Buffer is not defined ReferenceError: Buffer is not defined" error is thrown in the console.

I've tried different stuff like following this tutorial and adding

new webpack.ProvidePlugin({
  Buffer: ['buffer', 'Buffer'],
})

this custom Plugin (idk, thats what the inte.net told be).

I have tried everything I so StackOverflow is my last resort. Thanks for the answers!

So, after a while of testing stuff and even switching to another Hardware-Wallet, I finally got it working.

I installed the buffer package and in the polyfill.ts I added following lines:

let Buffer: any = require('buffer/').Buffer;
(window as any).Buffer = Buffer;

It feels like the biggest hotfix in my life, but at least it works now

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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