Ganache-cli: "TypeError: hex is not a function", please suggest some solutions.

Created on 16 May 2017  路  2Comments  路  Source: trufflesuite/ganache-cli


When I type testrpc, as follows:
cf@cf-VM42:~/myapp$ testrpc

Ubuntu 16.04 responses the following:

/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/node_modules/ethereumjs-util/index.js:31
exports.SHA3_NULL = Buffer.from(exports.SHA3_NULL_S, 'hex')
^

TypeError: hex is not a function
at Function.from (native)
at Function.from (native)
at Object. (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/node_modules/ethereumjs-util/index.js:31:28)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)

at Object. (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:6:17)

However, in another computer, it generates 10 Ethereum accounts as expected.
Thanks.

Expected Behavior


Current Behavior


Possible Solution


Steps to Reproduce (for bugs)



1.
2.
3.
4.

Context


Your Environment

  • Version used:
  • Environment name and version (e.g. PHP 5.4 on nginx 1.9.1):
  • Server type and version:
  • Operating System and version:
  • Link to your project:

Most helpful comment

I have the same issue on xenial .
I think this is the cause : WARN engine [email protected]: wanted: {"npm":">=3","node":">=6.5.0"} (current: {"node":"4.2.6","npm":"3.5.2"})

I ended up doing this
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

And reinstalling all my npm stuff.. took a bit to clean out the old and rebuild etc.. but it works now :)

All 2 comments

I have the same issue on xenial .
I think this is the cause : WARN engine [email protected]: wanted: {"npm":">=3","node":">=6.5.0"} (current: {"node":"4.2.6","npm":"3.5.2"})

I ended up doing this
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

And reinstalling all my npm stuff.. took a bit to clean out the old and rebuild etc.. but it works now :)

@chengfenlu I'm so sorry we never caught up with you on this. Fortunately, I think this one is fixed now. Please reopen if you're still having troubles.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gskerry picture gskerry  路  3Comments

remote-gildor picture remote-gildor  路  4Comments

xavierlepretre picture xavierlepretre  路  5Comments

mariam-crissi picture mariam-crissi  路  6Comments

SCBuergel picture SCBuergel  路  5Comments