3

i am trying to implement bingmap in angular 6 using "angular-map" npm packages for that i have refer also referred problem statement: not created "bingmaps" folder in node_modules

app.module.ts

/// <reference path="node_modules/bingmaps/types/MicrosoftMaps/Microsoft.Maps.All.d.ts" />
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { MapModule, MapAPILoader, BingMapAPILoaderConfig, BingMapAPILoader, WindowRef, DocumentRef, MapServiceFactory, BingMapServiceFactory } from "angular-maps";
import { AppComponent } from './app.component';

error:

ERROR in ./node_modules/angular-maps/fesm5/angular-maps.js Module not found: Error: Can't resolve 'bingmaps' in 'D:\bingmap\bingmap\node_modules\angular-maps\fesm5' i 「wdm」: Failed to compile. ERROR in src/app/app.module.ts(1,23): error TS6053: File 'D:/bingmap/bingmap/src/app/node_modules/bingmaps/types/MicrosoftMaps/Microsoft.Maps.All.d.ts' not found.

also installed npm install --save @types/bingmaps

kboul
  • 13,836
  • 5
  • 42
  • 53
Sarjerao Ghadage
  • 1,420
  • 16
  • 31

1 Answers1

5

I just tested both locally & on stackblitz and realized that there are some library dependencies you have to install in order to make angular-maps work. I received the same error as you but once I installed the libraries the error was gone.

Your package.json should contain these libraries:

"@types/bingmaps": "0.0.1",
"angular-maps": "^6.0.1",
"async": "^2.5.0",
"bingmaps": "^2.0.3",
"core-js": "^2.5.4",
"font-awesome": "^4.6.3",
"json-loader": "^0.5.7", 

so you need to install them

npm install --save angular-maps
npm install --save bingmaps
npm install --save @types/bingmaps
npm install --save async@2.5.0
npm install --save json-loader

I included font-awesome as external link in index.html:

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />

On app.module.ts include this as well as on app.component.ts:

import {
    MapModule,
    MapAPILoader,
    MarkerTypeId,
    IMapOptions,
    IBox,
    IMarkerIconInfo,
    WindowRef,
    DocumentRef,
    MapServiceFactory,
    BingMapAPILoaderConfig,
    BingMapAPILoader,
    GoogleMapAPILoader,
    GoogleMapAPILoaderConfig
} from 'angular-maps';

If you check also on stackblitz you can see on dependencies which extra libraries are used

kboul
  • 13,836
  • 5
  • 42
  • 53