Ionic with AngularJS - SyntaxError: Unexpected token [

白昼怎懂夜的黑 提交于 2020-01-15 09:51:13

问题


I'm trying to follow this tutorial:

https://scotch.io/tutorials/create-your-first-mobile-app-with-angularjs-and-ionic#toc-making-a-todo-app

and when I type ionic -v or just ionic it is giving me this error:

AppData\Roaming\npm\node_modules\ionic\dist\index.js:24
        const [xcode, iosDeploy, iosSim,] = yield Promise.all([
              ^

Io
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (\AppData\Roaming\npm\node_modules\ionic\bin\ionic:8:11)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

I have installed cordova and ionic globally: npm install cordova ionic -g and locally, but same outcome. I have also done npm init.

What is the reason for this?

Thanks.


回答1:


Take a look at this github issue: https://github.com/driftyco/ionic/issues/11588

And this: Ionic issue after installation

It looks to be an issue with the newer version of ionic. Upgrading your NodeJs version should do the trick.

You have to update NodeJS. CLI 3 needs >= 6.x



来源:https://stackoverflow.com/questions/43935306/ionic-with-angularjs-syntaxerror-unexpected-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!