【问题解决】truffle init出现“SyntaxError: Unexpected token”错误

使用truffle init命令时出现如下错误,主要是nodejs安装问题

SyntaxError: Unexpected token =

    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

在github上找到解决方法(https://github.com/trufflesuite/truffle/issues/128),把nodejs升级一下就可以了,这里我们通过安装n模块来升级

sudo npm install -g n
sudo n stable

你可能感兴趣的:(问题解决)