Ionic 2 newbie question

So I am new to Ionic 2 and Angular 2. I followed http://ionicframework.com/docs/v2/getting-started/tutorial/ and ran the command ionic start MyIonic2Project tutorial --v2 and it created the directory with correct files. When I ran the ionic serve nothing worked. I thought ionic serve command would transpile the ts and move correct files to www folder. I guess I was kidding myself. So I used gulp to move and transpiled ts files and also move them to www folder then updated the references to index.html page, but now I get ‘Uncaught ReferenceError: require is not defined’.

what am I doing wrong? thanks

You need to provide some more details if you want other people to help.

You are not supposed to do any manual steps of using gulp.
Once you run the Ionic Serve the build process creates a build folder under www with the transpiled files and other files needed to run the app.
After you run Ionic Serve you have to use the chrome debugger (Developer Tools) and view the console for any errors.

I created a new ionic 2 project and gave me a ‘No gulpfile found!’ warning and that’s all. When I do ionic serve command it gave me an error 'Error: ENOENT: no such file or directory, open ‘C:\Temp\ionic2\MyIonic2Project\www\index.html’

That’s all I get on the page. No error else where

Odd, that suggests it may have created an Ionic 1 project, not an Ionic 2 one. Ionic 1 uses Gulp, Ionic 2 doesn’t. Does the project have an ionic.config.json file containing "v2": true?

Which version of the Ionic CLI do you have installed? You can check by running ionic -v.

I used ionic start MyIonic2Project tutorial --v2 command

{
“name”: “MyIonic2Project”,
“app_id”: “”,
“v2”: true,
“typescript”: true
}

npm -v : 2.15.9
ionic -v : 2.0.0

I believe Ionic 2 requires npm 3. You can upgrade with

npm install -g npm

Also, the latest ionic (cli) is now 2.1.0.

before update ionic 2, it’s necessary to uninstall ionic 1 or beta

Follow this instructions to avoid problems

The Ionic CLI (that’s what you install with npm install ionic) is the same for both Ionic 1 and Ionic 2.

1 Like

Oh, I thought this statement also should be applied for ionic cli 1

Important: if you have installed the beta cli you should run npm uninstall -g ionic first. You need version 2.1.0 for this release. Check your cli version by running ionic -v in the command line.