I'm trying to start off my first ionic app; getting 'SyntaxError: Unexpected token [' on every ionic commands. Literally all ionic commands returning the same output.
$ ionic start test --v2
/Users/user/.nvm/versions/node/v4.1.1/lib/node_modules/ionic/dist/index.js:24
const [xcode, iosDeploy, iosSim,] = yield Promise.all([
^
SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452: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> (/Users/user/.nvm/versions/node/v4.1.1/lib/node_modules/ionic/bin/ionic:8:11)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
NPM: 4.5.0
OS: OSX Sierra
The solution is not to downgrade as suggested by the previously accepted answer, but to upgrade Node as suggested in this answer.
Ionic needs to run on Node > 6.
So I was solving it upgrading Node on my Mac using Brew like:
brew upgrade node
brew link --overwrite node
First one was upgrading Node. The second one was needed to overwrite other Node binaries I had.
Using Node 7 I was able to execute the ionic command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With