Ionic 2.0 navigation error

Hello I’ve been used to ionic 1 and I am currently new to this. Once I put the nav controller in the constructor it gives me and error and I get a blank page. The error says
ERROR in ./app/pages/page4/page4.js

Module build failed: SyntaxError: /Users/*/Desktop/M/app/pages/page4/page4.js: Unexpected token (8:16)

6 | })
7 | export class Page4 {
8 | constructor(nav: NavController) {
^ ← this is under the word Nav
9 |
10 | this.nav = nav;
11 | }

Ive been getting that error for a long time and don’t know how to fix it. Sorry if I sound like a noob.

1 Like

Hi

I’m in the same situation, did anyone find a solution?

Thank you very much!

ERROR in ./app/pages/search/search.js
Module build failed: SyntaxError: /Users/mossito/Documents/Programming/ionic2/iTunesBrowser/app/pages/search/search.js: Unexpected token (13:17)
11 | })
12 | export class SearchPage {

13 | constructor(nav: NavController) {
| ^
14 | this.nav = nav;
15 | }
16 | }
at Parser.pp.raise (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:1425:13)
at Parser.pp.unexpected (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:2905:8)
at Parser.pp.expect (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:2899:33)
at Parser.pp.parseBindingList (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:1605:12)
at Parser.pp.parseMethod (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:1097:22)
at Parser.pp.parseClassMethod (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:2581:8)
at Parser.pp.parseClassBody (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:2542:10)
at Parser.pp.parseClass (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:2425:8)
at Parser.pp.parseStatement (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:1889:19)
at Parser.pp.parseExportDeclaration (/Users/mossito/Documents/Programming/ionic2/iTunesBrowser/node_modules/babylon/index.js:2664:15)
@ ./app/app.js 13:14-46

Same Problem. Please try to give best solution for the error…:sob:

I’m still looking for a solution. I can’t work on any of my new apps until I’m able to figure this out.

solution in this thread:
Unexpected token while trying to inject NavController