0

I am trying to run "truffle init" in the empty directory, facing the following error.

/usr/local/lib/node_modules/truffle/build/cli.bundled.js:26041
  return new Promise((resolve, reject) => {
                                        ^
SyntaxError: Unexpected token >
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Can someone please help? thanks in advance!

[EDIT] After running "npm install -g truffle@latest" , got the following error:

/usr/local/lib/node_modules/npm/bin/npm-cli.js:79
  let notifier = require('update-notifier')({pkg})
      ^^^^^^^^
SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
  • What is your node version? You probably are using an old version try upgrading to at least node v8 – Ismael May 3 '18 at 15:56
  • $ node --version v0.10.25 – Miley May 3 '18 at 18:41
  • That is a really old version. If you are on Windows or Mac download the more recent binaries from nodejs.org/en/download, if you are on Linux try using your package manager and follow instructions from here nodejs.org/en/download/package-manager – Ismael May 3 '18 at 19:18
1

Use node version manager(nvm) to install the latest stable node js version. https://github.com/creationix/nvm The most recent stable version is 10.15.1

After that, Run the same command to not see the error.

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.