Reputation: 326
When running the command: near keys XXXXXXX.near
I'm getting the error below, I'm expecting that near-cli is using the mainnet network by default, but there seems to be an issue, as it says there is no account, but the account clearly exists.
An error occured
TypedError: [-32000] Server error: account XXXXXX.near does not exist while viewing
at JsonRpcProvider.sendJsonRpc (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:158:27)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async JsonRpcProvider.query (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:66:24)
at async Account.fetchState (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:47:23)
at async Account.state (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:54:9)
at async Near.account (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/near.js:41:9)
at async exports.keys (/usr/local/lib/node_modules/near-cli/index.js:195:19)
at async Object.handler (/usr/local/lib/node_modules/near-cli/utils/exit-on-error.js:39:9) {
[stack]: 'Error: [-32000] Server error: account XXXXX.near does not exist while viewing\n' +
' at JsonRpcProvider.sendJsonRpc (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:158:27)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:97:5)\n' +
' at async JsonRpcProvider.query (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:66:24)\n' +
' at async Account.fetchState (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:47:23)\n' +
' at async Account.state (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:54:9)\n' +
' at async Near.account (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/near.js:41:9)\n' +
' at async exports.keys (/usr/local/lib/node_modules/near-cli/index.js:195:19)\n' +
' at async Object.handler (/usr/local/lib/node_modules/near-cli/utils/exit-on-error.js:39:9)',
[message]: '[-32000] Server error: account XXXXXXX.near does not exist while viewing',
type: 'UntypedError',
context: undefined
}
Upvotes: 2
Views: 1233
Reputation: 326
You have to pass the NODE_ENV=mainnet
variable with the near-cli to specify which networkId to connect to. This worked for me NODE_ENV=mainnet near keys account.near
Upvotes: 1