3

I have tried to install and use the Truffle Framework through npm on Elementary OS (Ubuntu distribution). There where no obvious issues with the installation but when running any command e.g. "truffle init" or "truffle unbox metacoin" I get the error:

/usr/local/lib/node_modules/truffle/build/cli.bundled.js:64601
!function(e,t){ true?module.exports=t():"function"==typeof define&&define.amd?define("ganache",[],t):"object"==typeof exports?exports.ganache=t():e.ganache=t()}(global,function(){return function(e){var t={};function a(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},a.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.w={},a(a.s=1222)}([function(e,t,a){try{var n=a(1);if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(t){e.exports=a(1208)}},function(e,t){e.exports=__webpack_require__(3)},function(e,t){e.exports=__webpack_require__(0)},function(e,t

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
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 Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

I assume this is some sort of compatibility issue with ES5/6. But I am unsure as to why this would happen with a fresh install.

1 Answer 1

2
+50

apt install npm never worked properly for me.

Remove it and install as described here https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

npm uninstall -g truffle
apt purge npm
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
npm i -g truffle
1
  • This was exactly it, thanks! Shame the package used in the command on the truffleframework.com homepage doesn't appear to work... Commented Apr 16, 2018 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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