sebholstein / angular-google-maps

Angular 2+ Google Maps Components
https://angular-maps.com/
MIT License
2.03k stars 817 forks source link

Module not found for google-maps-types #1727

Closed IsaacSomething closed 5 years ago

IsaacSomething commented 5 years ago

Issue description After updating to the most recent release of @agm/core "@agm/core": "^1.0.0", I am receiving this issue.

Module not found: Error: Can't resolve '@agm/core/services/google-maps-types in ...

This seems to specifically be targeted from this import import { ControlPosition } from '@agm/core/services/google-maps-types';

In four files that contain that input.

This is the current package.json deps

"@agm/core": "^1.0.0",
"@agm/snazzy-info-window": "^1.0.0",

Other information If I navigate to the @agm package in the node_modules folder (This is after a complete uninstall and then reinstall) and then navigate to /core/services/google-maps-types.d.ts it seems like that file is not the same file that is in the github repo. For the ControlPosition enum the code in the nodule_modules is

// line 448
export declare enum ControlPosition {
    RIGHT_BOTTOM = 0,
    TOP_LEFT = 1,
    TOP_CENTER = 2,
    TOP_RIGHT = 3,
    LEFT_CENTER = 4,
    LEFT_TOP = 5,
    LEFT_BOTTOM = 6,
    RIGHT_TOP = 7,
    RIGHT_CENTER = 8,
    BOTTOM_RIGHT = 9,
    BOTTOM_LEFT = 10,
    BOTTOM_CENTER = 11
}

Yet in the repo it is

// line 516
export enum ControlPosition {
  RIGHT_BOTTOM,
  TOP_LEFT,
  TOP_CENTER,
  TOP_RIGHT,
  LEFT_CENTER,
  LEFT_TOP,
  LEFT_BOTTOM,
  RIGHT_TOP,
  RIGHT_CENTER,
  BOTTOM_RIGHT,
  BOTTOM_LEFT,
  BOTTOM_CENTER,
}

https://github.com/SebastianM/angular-google-maps/blob/master/packages/core/services/google-maps-types.ts

ghost commented 5 years ago

ControlPosition seems fine. Can you try deleting node_modules and running npm install? Also, what does the import line looks like?

IsaacSomething commented 5 years ago

Okay will try that

The import line looks like this import { ControlPosition } from '@agm/core/services/google-maps-types';

ghost commented 5 years ago

try also import { ControlPosition } from '@agm/core'

IsaacSomething commented 5 years ago

I have uninstalled the node_modules and then npm install but I still seem to have a different version of that file, like an older version. I am going to try install on a blank project.

Using import { ControlPosition } from @agm/core I get the error

No exported member 'ControlPosition'
ghost commented 5 years ago

It's not a different version, it's after compilation. That's not the issue. If you go back to agm-core-1.0.0-beta.7 you'll see the same thing You're correct that import { ControlPosition } from @agm/core doesn't work, it currently shouldn't.

IsaacSomething commented 5 years ago

It's not a different version, it's after compilation. That's not the issue. If you go back to agm-core-1.0.0-beta.7 you'll see the same thing

Okay yeah that makes sense

ghost commented 5 years ago

I trust this issue was fixed after reinstalling dependencies?

IsaacSomething commented 5 years ago

No i cant get it to work. What i am going to try though is to use the @types/googlemaps instead. Thanks for your help

potham commented 5 years ago

@doom777 I am also facing the same issue

IsaacSomething commented 5 years ago

just putting this here for reference https://github.com/SebastianM/angular-google-maps/issues/1729