Ganache-cli: Installing testrpc on Mac

Created on 17 Nov 2016  路  15Comments  路  Source: trufflesuite/ganache-cli

I am trying to install testrpc on my mac system(10.11.3-OS X EI Capitan).

Issued

sudo npm install -g ethereumjs-testrpc

This doesn't work for me. I even tried to install from source. I am getting the following error,
Error: Cannot find module './build/Release/scrypt'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-wallet/node_modules/scrypt.js/node_modules/scrypt/index.js:3:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)

Please let me know the right procedure to install it.

Thanks
Anand

needs more info

Most helpful comment

I had the same problem (mac v10.10.5), just solved it.

  1. make sure u install or upgrade 'scrypt' : sudo npm install scrypt
  2. if u still get wrong for testrpc like this:
Secp256k1 bindings are not compiled. Pure JS implementation will be used.
/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/solc/soljson.js:1
...................

then search for the following file and open it with Atom or Vim or other editors:
/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/scrypt/index.js

  1. u will see:
"use strict";

var scryptNative = require("./build/Release/scrypt")
  , Crypto = require("crypto")
  , Os = `require("os")

replace ./build/Release/scrypt with scrypt

  1. save and run testrpc again, it should work this time~

All 15 comments

@anandsemtech this issue related with https://github.com/barrysteyn/node-scrypt
you receive this error because package is not compiled

Sounds like you don't have the XCode command line tools installed:

You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads

Approach 1:

sudo npm install -g ethereumjs-testrpc

Approach 2

git clone https://github.com/ethereumjs/testrpc.git
cd testrpc
sudo npm install .

Both the approaches do not solve my problem.

@anandsemtech Neither of these approaches will address the problem if it's because you don't have the XCode command line tools installed, which will prevent scrypt and other packages from building.

What's the output of xcode-select -p on your machine?

The output of the command:
/Applications/Xcode.app/Contents/Developer

Installed command line tools:
http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/

I had the same problem (mac v10.10.5), just solved it.

  1. make sure u install or upgrade 'scrypt' : sudo npm install scrypt
  2. if u still get wrong for testrpc like this:
Secp256k1 bindings are not compiled. Pure JS implementation will be used.
/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/solc/soljson.js:1
...................

then search for the following file and open it with Atom or Vim or other editors:
/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/scrypt/index.js

  1. u will see:
"use strict";

var scryptNative = require("./build/Release/scrypt")
  , Crypto = require("crypto")
  , Os = `require("os")

replace ./build/Release/scrypt with scrypt

  1. save and run testrpc again, it should work this time~

@blond007 Thank you! Number 3 worked for me.

When I execute the command

testrpc

I get the following error,

/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/lib/index.js:29
function VM (opts = {}) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/lib/hooked.js:6:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

Please let me know the better way to solve it.

I have similar issue when i run testrpc. Not sure how to solve it

/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/lib/index.js:29
function VM (opts = {}) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/lib/hooked.js:6:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

@anandsemtech @najienka You guys need to upgrade your version of node to 6 or above. This isn't the same issue as the original poster.

Thanks @tcoulter and @blond007 . Now I am able to run testrpc without any issues.

@anandsemtech pls how did you solve the issue? i've tried updating my version of node but it doesn't work

@blond007 your steps worked for me . THANKS!

@anandsemtech can we close this issue?

Yes. Thanks for the timely support.

Was this page helpful?
0 / 5 - 0 ratings