trufflesuite / ganache-cli-archive

Fast Ethereum RPC client for testing and development. See https://github.com/trufflesuite/ganache for current development.
https://www.trufflesuite.com/ganache
MIT License
3.36k stars 696 forks source link

Node 14 ganache-cli Error: Callback was already called. #768

Closed mudgen closed 3 years ago

mudgen commented 4 years ago

I know that this issue was filed 3 months ago but the issue is locked and I don't see any progress.

I need to use Node 14 but I can't because of a bug in ganache-cli.

davidmurdoch commented 4 years ago

Does the workaround provided in that issue not solve the problem while we rewrite some internals for Node 14?

For those of you using Node 14, you'll need to launch ganache-cli via node 8, 10, or 12 until this is fixed. For example, run nvm use 12 && npm install ganache-cli -g to install for node 12, and then run ganache-cli with nvm use 12 && ganache-cli.

https://github.com/trufflesuite/ganache-cli/issues/732#issuecomment-623782405

mudgen commented 4 years ago

No because I don't want to use nvm and I need to use Node 14. But I do appreciate that the workaround was given.

kende commented 4 years ago

Same issue here, except the workaround doesn't work for me either. Tried Node 12.18.3 (LTS), 10, and 8 with no luck.

davidmurdoch commented 4 years ago

@kende This workaround should work. Can you provide reproduction steps?

sujithsomraaj commented 4 years ago

I had the same issue but after downgrading to Node 12.18.0 it is working. It's an issue of Node 14 and Ganache.

What I did is

  1. sudo npm install -g n
  2. sudo n 12.18.0

Then when you run ganache it will work

davidmurdoch commented 3 years ago

Fixed in https://github.com/trufflesuite/ganache-cli/releases/tag/v6.12.0

ltfschoen commented 3 years ago

if you're still getting this error with the latest version, check that you don't have conflicting Yarn and NPM versions of ganache-cli.

i've been following these instructions to use The Graph https://thegraph.com/docs/quick-start#local-development, where I've had Node.js 14.7 installed (not the latest, but should be sufficient), and ran the following, which says it has installed Ganache CLI v6.12.2

$ yarn global add truffle ganache-cli
yarn global v1.22.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Installed "truffle@5.1.62" with binaries:
      - truffle
success Installed "ganache-cli@6.12.2" with binaries:
      - ganache-cli
✨  Done in 158.62s.
$ ganache-cli -h 0.0.0.0

Ganache CLI v6.10.1 (ganache-core: 2.11.2)
Error: Callback was already called.
    at /Users/ls/.nvm/versions/node/v14.7.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:19:276
    at s.<anonymous> (/Users/ls/.nvm/versions/node/v14.7.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:19:2238)
    at s.emit (events.js:314:20)
    at s.destroy (/Users/ls/.nvm/versions/node/v14.7.0/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:39:744230)
    at finish (_stream_writable.js:658:14)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

But the old error of this issue still appeared. If you look closely it's because the ganache-cli version that's running is Ganache CLI v6.10.1 instead of Ganache CLI v6.12.2, and I found out that was because I'm on an old laptop where I'd previously installed it globally using NPM instead of Yarn, which I could check with:

$ ganache-cli --version
Ganache CLI v6.10.1 (ganache-core: 2.11.2)

$ npm list -g --depth=0
/Users/ls/.nvm/versions/node/v14.7.0/lib
├── ganache-cli@6.10.1
├── npm@6.14.7
├── truffle@5.1.41
└── yarn@1.22.4

$ yarn global list
yarn global v1.22.4
info "ganache-cli@6.12.2" has binaries:
   - ganache-cli
info "truffle@5.1.62" has binaries:
   - truffle
✨  Done in 0.59s.

So to avoid the conflict I just removed the NPM version, so it would revert to using the Yarn version instead.

npm uninstall -g ganache-cli