near / near-cli

General purpose command line tools for interacting with NEAR Protocol
https://docs.near.org
MIT License
193 stars 91 forks source link

Using ledger fails with `near generate-key` on fresh install #1056

Closed austinabell closed 6 months ago

austinabell commented 1 year ago

Describe the bug

near generate-key --useLedgerKey failed on a fresh install on a m2 mac with the following error:

Error: Cannot find module '@ledgerhq/hw-transport-node-hid'
Require stack:
- /opt/homebrew/lib/node_modules/near-cli/middleware/ledger.js
- /opt/homebrew/lib/node_modules/near-cli/bin/near-cli.js
- /opt/homebrew/lib/node_modules/near-cli/bin/near
    at Module._resolveFilename (node:internal/modules/cjs/loader:1053:15)
    at Module._load (node:internal/modules/cjs/loader:898:27)
    at Module.require (node:internal/modules/cjs/loader:1120:19)
    at require (node:internal/modules/helpers:112:18)
    at useLedgerSigner (/opt/homebrew/lib/node_modules/near-cli/middleware/ledger.js:12:43)
    at /opt/homebrew/lib/node_modules/near-cli/node_modules/yargs/build/index.cjs:229:17
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/homebrew/lib/node_modules/near-cli/middleware/ledger.js',
    '/opt/homebrew/lib/node_modules/near-cli/bin/near-cli.js',
    '/opt/homebrew/lib/node_modules/near-cli/bin/near'
  ]
}

To Reproduce

I only installed the cli with npm install -g near-cli and then immediately ran that command. npm version 9.6.2, node version 19.4.0

Expected behavior not error

Screenshots n/a

Desktop (please complete the following information): Mac m2

Additional context

I don't need this for anything anymore, used the rust cli, but reporting in case others run into it.

frol commented 1 year ago

@austinabell Thanks for reporting it! Consider using https://github.com/near/near-cli-rs

austinabell commented 1 year ago

@austinabell Thanks for reporting it! Consider using near/near-cli-rs

I did end up using it, as I mentioned in "Additional Context", just previously assumed there would be better ledger support in this CLI :)

gagdiez commented 6 months ago

near-cli no longer supports ledger, please consider migrating to near-cli-rs