ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.02k stars 13.51k forks source link

ReferenceError: Can't find variable: ionic #6381

Closed elineopsommer closed 8 years ago

elineopsommer commented 8 years ago

Short description of the problem:

Whenever I install an starter application of Ionic 2 and run it on iOS (safari), I get an error in the console 'ReferenceError: Can't find variable: ionic'

Steps to reproduce:

  1. sudo npm install -g ionic@beta cordova
  2. ionic start myTutorial tutorial --v2
  3. ionic serve -w safari --platform ios
  4. inspect element -> console

Which Ionic Version? 2.x

Run ionic info from terminal/cmd prompt: Cordova CLI: 5.4.1 Gulp version: CLI version 3.9.0 Gulp local: Local version 3.9.1 Ionic Framework Version: 2.0.0-beta.5 Ionic CLI Version: 2.0.0-beta.25 Ionic App Lib Version: 2.0.0-beta.15 ios-deploy version: Not installed ios-sim version: Not installed OS: Mac OS X El Capitan Node Version: v5.3.0 Xcode version: Xcode 7.2 Build version 7C68

jgw96 commented 8 years ago

Hey @elineopsommer ! Thanks for opening an issue with us. The issue stems from that starter not including ionic or angular by default. To use this starter you can simply start a new v2 project with ionic start MyTutorial --v2 --ts which will start a tabs starter for you and then you can simply copy and paste the contents of the app directory in the tutorial starter into that fresh project you just made. Hope this makes sense!

brandyscarney commented 8 years ago

This is actually caused by the lowercase p in ionicPlatform. Changing the URL to: http://localhost:8100/?ionicPlatform=ios should resolve the error, but I don't think the error should affect your app at all. There is an open issue for it on the CLI (https://github.com/driftyco/ionic-cli/issues/942) so I am going to close this. Thanks!

MZabih commented 7 years ago

remove platforms and add it again. after adding platform ionic build iOS ionic run ios good luck

MZabih commented 7 years ago

sometime it happens when your bundle identifier do not match with the one present in ios

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.