I am getting the following error while doing truffle init. I have followed the steps here: enter image description here


When I get to truffle init, I get the following error:

!function(e,a){ true?module.exports=a():"function"==typeof define&&define.amd?define("ganache",[],a):"object"==typeof exports?exports.ganache=a():e.ganache=a()}(global,function(){return function(e){var a={};function t(c){if(a[c])return a[c].exports;var n=a[c]={i:c,l:!1,exports:{}};return e[c].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=e,t.c=a,t.d=function(e,a,c){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:c})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},t.p="",t.w={},t(t.s=1036)}([function(e,a,t){try{var c=t(1);if("function"!=typeof c.inherits)throw"";e.exports=c.inherits}catch(a){e.exports=t(1021)}},function(e,a){e.exports=__webpack_require__(3)},function(e,a,t){"use strict";var c="function"==typeof Symbol

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

Can anyone tell me what is the problem here?

EDIT While using truffle, truffle init, truffle unbox webpack, I am getting the same error.



If you are encountering the same error, please check that your node is updated to the latest version. My node was updated to 6.11.3 while the LTS was 8.

Download Here

Release Schedule Here (LTS)

You can check node version using

node -v

and npm version using

npm -v

A way to "bypass" this issue would be using a boilerplate from here, with regards to the tutorial doing truffle unbox webpack would probably be the best prerequisite for what the tutorial is explaining. For everything front end related, you could then basically just edit everything according to your tutorials' needs.

  • I'm sorry I didnt really understand what to do exactly. Can you please elaborate?
    – coder123
    Jun 27 '18 at 9:14
  • truffle init is suppose to create a very very minimalistic boilerplate the tutorial tells you to enhance. truffle unbox webpack initiates a more elaborate boilerplate, which already has many of the things from the tutorial in place. Then instead of creating all these components, you can just edit them if you wish to follow along the tutorial. Jun 27 '18 at 9:21
  • Nikita I feel my truffle only is not working! I tried doing truffle unbox webpack and it still gives me the same error. What could be the possible reason?
    – coder123
    Jun 27 '18 at 9:25
  • I feel I know what the problem is. The syntax error is occurring because of uneven number of opening and closing brackets. I am sure this is an unusual request but can you send me your 60353th line of your cli.bundled.js because that is where the rror is.
    – coder123
    Jun 27 '18 at 9:49
  • 1
    Thanks @Nikita Fuchs but I solved the issue. It was with my mac not downloading truffle properly because of node not being updated!
    – coder123
    Jun 27 '18 at 11:33

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.