Host of issues with Cordova and Ionic


Hi. I recently did an upgrade to the newest version of Ionic to fix some of the bugs I had in my app - well after this I’ve had a whole source of issues. I can no longer build it in Visual Studio, and using the CLI is a game of roulette.

I’ve tried to fix each issue as they arise as I go, but for this following one even Google can’t help - so here I am.

This is my following issue when I attempt to run it from Visual Studio 2017 Community Edition.

ionic-app-scripts build
[12:21:26]  ionic-app-scripts 3.1.5 
[12:21:26]  build dev started ... 
[12:21:26]  clean started ... 
[12:21:26]  clean finished in 2 ms 
[12:21:26]  copy started ... 
[12:21:26]  deeplinks started ... 
[12:21:26]  deeplinks finished in 117 ms 
[12:21:26]  transpile started ... 
[12:21:26]  ionic-app-script task: "build" 
[12:21:26]  SyntaxError: Unexpected token { 
SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (xxx\src\node_modules\@angular-devkit\build-optimizer\src\build-optimizer\webpack-loader.js:12:27)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Web\\External\\Node.exe" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Web\\External\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:build" "--color=always"
npm ERR! node v5.4.1
npm ERR! npm  v3.3.4
npm ERR! ionic:build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ionic:build script 'ionic-app-scripts build'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build
npm ERR! You can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     xxx\src\npm-debug.log

Process terminated with code 1.

'xxx has been altered for this code snippit to move my directory listing.

Any ideas? Oh - I’ve never been able to find this npm-degug.log file…


Your Node is really old. I’d upgrade that first.


I ended up rolling my Node version back because it was incompatible with the newest version of Ionic. What version would you recommend?


Current LTS from - best via nvm or nvm-windows so it’s easy to switch.


I updated my node and when I view the version in the command window it shows as 8.9.3, whereas VS2017 is still showing 5.4.1… I’ve restarted VS multiple times but no change.


Just FYI, these kind of issues are why I stopped using VS with Ionic. I moved from VS to Sublime, and recently moved to VS Code, which is working much better than VS did. That might not solve your problem, but if you think back and remember similar problems before, you might want to change your IDE.


Hmmmm how hard would it be to move over to VS Code? I think that might be a long-term solution. And by VS Code do you mean


Yes. I don’t think it would be hard, but maybe your system is messed up right now, so who knows. It manages Typescript better than either Sublime or VS did, which is why I switched.


Brill. I’ve just installed it now and added the Cordova extension to it, about to add Ionic too (There’s bloody loads of them!)


You don’t really need any of these. Using the CLI directly is often less error prone.


+1 for this. Any extensions you add are additional things you might have to debug. The problem is that Ionic changes a lot, and it depends on libraries that change a lot.


Hmmm okay gotcha. This does sound a lot more sensible. Thanks


Just acquick question: sublime has this great thumbnsil source view where u can see your code as a whole with syntax highlighting in one go

U know if vscode has this too? Cant find it. Maybe not using the right keyword for search




Great thank you!!!