Git Product home page Git Product logo

Comments (6)

edmundo096 avatar edmundo096 commented on September 21, 2024 3

After analysing the app.component.ts file, I found that it's quite outdated? Since it still requires the old Ionic 2.x ionic-native module.

Better stay off of this outdated super template.
See Issue about not compatible with 3.0.1 #86 and the Pull requests #95 and #84

But to remove this error we need to change...

src/app/app.component.ts

import { StatusBar, Splashscreen } from '`ionic-native';
...
constructor(translate: TranslateService, platform: Platform, settings: Settings, config: Config) {
...
StatusBar.styleDefault();
Splashscreen.hide();

with

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
...
constructor(translate: TranslateService, platform: Platform, settings: Settings, config: Config, statusBar: StatusBar, splashScreen: SplashScreen) {
...
statusBar.styleDefault();
splashScreen.hide();

Then run

$ ionic plugin add cordova-plugin-camera
$ npm install --save @ionic-native/camera

$ ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"
$ npm install --save @ionic-native/google-maps

src/pages/item-create/item-create.ts

import { Camera } from 'ionic-native';
...
constructor(public navCtrl: NavController, public viewCtrl: ViewController, formBuilder: FormBuilder) {
...
  getPicture() {
    if (Camera['installed']()) {
      Camera.getPicture({

to

import { Camera } from '@ionic-native/camera';
...
constructor(public navCtrl: NavController, public viewCtrl: ViewController, formBuilder: FormBuilder, private camera: Camera) {
...
  getPicture() {
    if (Camera['installed']()) {
      this.camera.getPicture({

src/pages/map/map.ts

Then change in the file the lines, from

import { GoogleMap, GoogleMapsLatLng } from 'ionic-native';
...
constructor(public navCtrl: NavController, public platform: Platform) {}
...
    GoogleMap.isAvailable().then(() => {
      const position = new GoogleMapsLatLng(43.074395, -89.381056);

to

import { GoogleMap, GoogleMaps, LatLng } from '@ionic-native/google-maps';
...
constructor(public navCtrl: NavController, public platform: Platform, private googleMaps: GoogleMaps) {}
...
    this.googleMaps.isAvailable().then(() => {
      const position = new LatLng(43.074395, -89.381056);

And comment out the entire content of src/app/main.prod.ts

Angular now will complain about Components error and will not render anything.

So, as I said before, better stay out from this super template, and use it only for reference for now.

from ionic-starter-super.

danielsogl avatar danielsogl commented on September 21, 2024 1

Hey @manuelfink, with the next release, this template uses the latest native version.

from ionic-starter-super.

edmundo096 avatar edmundo096 commented on September 21, 2024

Same issue here.

Noticed that the old package ionic-native is not installed nor saved in the dependencies as in my other Ionic (old v2.x) projects.
So I tried and executed npm install ionic-native --save, but it didn't worked either (I had to try at least).

Ended up with the following package.json (fragment):

    "@ionic-native/core": "3.4.2",
    "@ionic-native/splash-screen": "3.4.2",
    "@ionic-native/status-bar": "3.4.2",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.0.1",
    "ionic-native": "^3.5.0",

from ionic-starter-super.

snowyu avatar snowyu commented on September 21, 2024

confirmed.

from ionic-starter-super.

PRINCEHR avatar PRINCEHR commented on September 21, 2024

Guys, I am also facing same issue
Uncaught Error: Cannot find module "ionic-native"
at Object.276 (main.js:617)
at webpack_require (bootstrap 55c373d479ee4bd0c837:54)
at Object.219 (main.ts:5)
at webpack_require (bootstrap 55c373d479ee4bd0c837:54)
at Object.196 (main.js:249)
at webpack_require (bootstrap 55c373d479ee4bd0c837:54)
at webpackJsonpCallback (bootstrap 55c373d479ee4bd0c837:25)
at main.js:1

Any Help to resolve this issue

from ionic-starter-super.

edmundo096 avatar edmundo096 commented on September 21, 2024

@PRINCEHR
You should post more info like the original poster (versions, OS, etc that the CLI prints). Research how to do it (hint: use ionic info). Also try updating your global ionic CLI, and try on a new clean project.
Then either open a new ticket and/or reference this ticket.

from ionic-starter-super.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.