I want to create Ledger signer instances from ledger wallet. However, I always got an error that says "cannot open device".
Would it be possible to create Ledger instances from a ledger wallet? I an using Ledger Nano S.
This is my code and error.
let firstSigner: LedgerSigner;
console.log("creating first signer")
firstSigner = new LedgerSigner(provider, "hid", "m/44'/60'/0'/1");
console.log("first signer", await firstSigner.getAddress())
let secondSigner: LedgerSigner;
console.log("creating second signer")
secondSigner = new LedgerSigner(provider, "hid", "m/44'/60'/0'/2");
console.log("second signer", await secondSigner.getAddress())
creating first signer
first signer 0x2...
creating second signer
(node:22455) UnhandledPromiseRejectionWarning: Error: cannot open device with path IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/X.test.../Nano S@0/AppleUserUSBHostHIDDevice
at new HID (/Users/xxx/node_modules/node-hid/nodehid.js:49:17)
at /Users/xxx/node_modules/@ledgerhq/hw-transport-node-hid/src/TransportNodeHid.js:118:37
(Use `node --trace-warnings ...` to show where the warning was created)
(node:22455) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:22455) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Does anyone know how to solve this problem?