near / create-near-app

Create a starter app hooked up to the NEAR blockchain
https://near-examples.github.io/hello-near-examples/
MIT License
353 stars 157 forks source link

support for node js 18 #1947

Closed gustawdaniel closed 6 months ago

gustawdaniel commented 1 year ago

This generator creates app, that does not work in node 18.

In javascript integration tests, there is dependency from old ava.

With ava 4 I have this error: https://app.gleap.io/share/xGhItzd4ZioRI5lWgOwxpJH5zxpqL4iw2IbTuQrFqjk4DVIFN32zPx8okEE0CdJNf1GkLv?u=6ff087b6-28a9-4534-82d5-22d2ee0baeca&h=793e351dfcfbd34d6a3310544869953f4de369d8c28c6de1c296a0ed706c1c91

ava from 5 is compatible with node from 14 to 18. https://github.com/avajs/ava/releases

But even update to ava 5.1.0 not solves problem.

In line:

const contract = await root.createSubAccount('test-account');

there is thrown exception:

TypedError: Exceeded 10 attempts for http://localhost:4381.
    at Object.fetchJson (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/utils/web.js:47:15)
    at async /home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/providers/json-rpc-provider.js:312:34
    at async Object.exponentialBackoff [as default] (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24)
    at async JsonRpcProvider.sendJsonRpc (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/providers/json-rpc-provider.js:304:26)
    at async JsonRpcProvider.query (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/providers/json-rpc-provider.js:116:22)
    at async Account.findAccessKey (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/account.js:186:31)
    at async Account.signTransaction (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/account.js:91:31)
    at async /home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/account.js:118:34
    at async Object.exponentialBackoff [as default] (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24)
    at async Account.signAndSendTransactionV2 (/home/daniel/exp/web3/bdl/near-js/integration-tests/node_modules/near-api-js/lib/account.js:117:24) {
  type: 'RetriesExceeded',
  context: undefined
}

I see that near-cli is using relatively old near-api-js

npm ls near-api-js
near-js@1.0.0 /home/daniel/exp/web3/bdl/near-js
└─┬ near-cli@3.4.2
  └── near-api-js@0.44.2

It can be connected with this issue:

https://github.com/near/near-cli/issues/1001

gagdiez commented 6 months ago

latest version supports node v18