0

My environment

ganache-cli 6.4.4
node v6.14.3
Mac OS Terminal

I run the following commands to install ganache-cli

Aseems-MacBook-Pro:bdnd aseem$ nvm use v8.11.3 
Aseems-MacBook-Pro:bdnd aseem$ npm install -g ganache-cli
/Users/aseem/.nvm/versions/node/v6.14.3/bin/ganache-cli -> /Users/aseem/.nvm/versions/node/v6.14.3/lib/node_modules/ganache-cli/cli.js
/Users/aseem/.nvm/versions/node/v6.14.3/lib
└── ganache-cli@6.4.4 

My node version is

node -v
v6.14.3

But when I try to run ganache cli I get this

Aseems-MacBook-Pro:bdnd aseem$ ganache-cli
/Users/aseem/.nvm/versions/node/v6.14.3/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:47
!function(){var r,a={};function i(){}function o(e){return e}function c(e){return!!e}function f(e){return!e}var s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this;function d(e){return function(){if(null===e)throw new Error("Callback was already called.");e.apply(this,arguments),e=null}}function u(e){return function(){null!==e&&(e.apply(this,arguments),e=null)}}null!=s&&(r=s.async),a.noConflict=function(){return s.async=r,a};var l=Object.prototype.toString,b=Array.isArray||function(e){return"[object Array]"===l.call(e)};function p(e){return b(e)||"number"==typeof e.length&&e.length>=0&&e.length%1==0}function h(e,t){for(var r=-1,n=e.length;++r<n;)t(e[r],r,e)}function m(e,t){for(var r=-1,n=e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}function x(e){return m(Array(e),function(e,t){return t})}function v(e,t){for(var r=0;r<e.length;r++)if(e[r]===t

SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/aseem/.nvm/versions/node/v6.14.3/lib/node_modules/ganache-cli/cli.js:12:13)

According to the github page I should Make sure you have Node.js (>= v6.11.5) installed. which I did. The FAQ does not contain anything about syntax errors. Is the documentation incorrect or am I missing something else?

  • Regardless of your question, you should definitely upgrade your node version (I recommend at least v10.16.0). – goodvibration Jun 30 at 12:51
  • 1
    Also, do you understand what nvm use v8.11.3 means? – goodvibration Jun 30 at 12:53
  • @goodvibration You are right. I added answer telling what mistake I was doing. – Aseem Bansal Jun 30 at 15:26
0

The mistake that I was doing was that I was not running nvm use v8.11.3 directly in my terminal. I had a env.sh script containing nvm use v8.11.3. I was running bash ./env.sh to run the script. I assumed that changed the node version in my terminal. But it turns out that does not work. That change was valid only till the script execution happened. I had to run . ./env.sh to run the script to use the correct node version.

This turned out not be an issue with ganache. It turned out to be an incorrect way in which I was setting up the environment to do the installation itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.