Testing [email protected] on OSXrun with testrpc works but on our Circle build machine running ubuntu throws:
ubuntu@box981:~/colonyDapp$ testrpc
/opt/circleci/nodejs/v5.5.0/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:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/opt/circleci/nodejs/v5.5.0/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/index.js:1:80)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
The same but with testrpc v 3.0.1 runs successfully.
Same thing here.
Which version of node are you using? Try with node 6 or 7.
It works for me with version 6.9.1 of node js
Hi @elenadimitrova. The authors of ethereumjs-vm have, against my suggestion, upgraded all of their code to ES6. This is going to fail with older node versions, as described by @fanatid. I'd love to know if this is a blocker for anyone, or if upgrading their node version is a completely fine solution. My warning to the ethereumjs-vm authors was that it would reduce support for older versions, as you've seen.
@tcoulter anyone can use older node version with babel just passing ignore: false to babel-register.
I'm not big fan of babel and transpliters, but should admit that babel makes life easier for devs.
@fanatid That is a solution the ethereumjs-vm developers suggested. It can be a drop in solution (and probably will be in this case); that said, I've had so much trouble with it in the past and found it finicky. I now attempt to stay away from it and instead just code in vanilla ES5 (this is the strategy I take for Truffle and the TestRPC)
It's not a blocker for me to update my nodejs but I totally agree that it's not a good idea to use ES6 since a bunch of other people could have a hard time upgrading the node.
There are tools you can use to manage different versions of node on the same machine:
https://github.com/tj/n
https://github.com/creationix/nvm
On balance, my thoughts are that there are lots of reasons to use the latest version of Node besides the additional language features brought by ES2015 - bug fixes, security fixes, memory and garbage collection fixes, V8 improvements... the list goes on.
I'll add a notice to the start of the README that details that [email protected] requires at least Node 6.9.1
Thanks @johnmcdowall
Most helpful comment
Which version of node are you using?Try with node 6 or 7.