Problem with : Cannot find name 'NativeGeocoder' (plugin)

Hi there,

everything was working yesterday.

Do you have any idea about this :

This happens when I try to run android --device.

I also check my files using nativegeocoder
In the constructor :
image
The import :


In my function :

/* 
  This function will get the location by using the native location option on the smartphone.
  It will return the current position from the latitude and longitude variables.
  The result will be : Address, City, Postal Code and Country.
  */
  private getLocation() {
    
    // Get the current latitude & longitude if the Location option is enable on the device
    this.geolocation.getCurrentPosition()
      .then((resp) => {
        this.position = {

          // Create latitude (lat) and longitude (lng) variables with the location informations
          lat: resp.coords.latitude,
          lng: resp.coords.longitude
        };

        this.nativeGeocoder.reverseGeocode(this.position.lat, this.position.lng)
        .then((result: NativeGeocoderReverseResult) => 
        {
          // Put the result of the GeocoderReverse in the fullAddress variable
          this.fullAddress = result;
          // Put all the parameters in one
          this.addressString = result.street + ', ' + result.city + ' ' + result.postalCode + ', ' + result.countryName;
        })
        .catch((error: any) => alert(error));
      })
      .catch((error) => {
        alert('getLocation error\n' + JSON.stringify(error));
      })
  }

I’m a bit stressed about that, I need it to work shortly… please help.

Thanks in advance guys

So what changed codewise from yesterday?

  1. You’re referencing NativeGeocoderForwardResult but it doesn’t look like you imported it.

  2. You’re using NativeGeocoderReverseResult in your code instead of a public declaration.
    I have a program using NativeGeocoding, but not on hand. So I’m not 100% sure on forwardResult and reverseResult, but should you be using a public declaration for those as well?

@jaydz @Sujan12
Alright, I did this :

npm install @types/googlemaps --save-dev

And it works now !

What does it change to use -dev at the end ?

Don’t really know what happened
Thanks anyway.

Changes the library from dependencies to devDependencies.

1 Like

To expand on what @Sujan12 said, things in dependencies are needed to run your app, while things in devDependencies are only needed to build it.

1 Like