0

I have a Phonegap app and need to build it in a Mac. Everything works in a machine and I'm trying to configure a new one, but on this, when I run phonegap platform add ios I receive the following error:

$ phonegap platform add ios
/usr/local/lib/node_modules/phonegap/lib/phonegap/util/connect-proxy.js:21
                fs.readFile(settings, (err, data) => {
                                                  ^^
SyntaxError: Unexpected token =>
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/phonegap/lib/phonegap/serve.js:9:23)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Both Macs are running with node v0.12.7 and npm 2.11.3.

June
  • 592
  • 8
  • 18

2 Answers2

0

Apparently phonegap is using ECMAScript 6 Features like Arrow Functions. I think this is resulting into your error, because you are still using Node v0.12.7, which does not support these features. Installing the latest LTS version from Official Node.js should fixed that.

For further information please have a look at the phonegap requirements.

Beat
  • 4,386
  • 2
  • 35
  • 52
0

Please update your node and npm version to solved your problem.

Hiten
  • 724
  • 1
  • 8
  • 23