question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GET: angular2-google-maps/core 404 (Not Found)

See original GitHub issue

Issue description

Error in browser console and angular2 app not working after adding angular2-google-maps: GET http://localhost:4200/angular2-google-maps/core 404 (Not Found)

However ng serve does not give any error. (I am using Angular CLI ng)

Steps to reproduce and a minimal demo of the problem

Addding the following line to src/main.ts:

import {GOOGLE_MAPS_PROVIDERS} from 'angular2-google-maps/core';  // Change 1

And then bootstrapping App with GOOGLE_MAPS_PROVIDERS

bootstrap(AppComponent, [
       ..,
    HTTP_PROVIDERS,
    GOOGLE_MAPS_PROVIDERS,   // Change 2
        ..,
])

Making these changes to an already functioning app is causing the error.

Current behavior

Giving an error (in browser console)

zone.js:101 GET http://localhost:4200/angular2-google-maps/core 404 (Not Found)

Angular app is not working (stuck at loading…)

Expected/desired behavior

I’d expect to see no error in console and that app works properly.

angular2 & angular2-google-maps version

Angular: 2.0.0-rc.4 Maps: 0.12.0

Other information

Some of the relevant npm dependencies and their versions:

    "@angular/common": "^2.0.0-rc.4",
    "@angular/compiler": "^2.0.0-rc.4",
    "@angular/core": "^2.0.0-rc.4",
    "@angular/forms": "^0.1.1",
    "@angular/http": "^2.0.0-rc.4",
    "@angular/platform-browser": "^2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "^2.0.0-rc.4",
    "@angular/router": "3.0.0-alpha.7",

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ghostcommented, Aug 1, 2016

@yanqui92

Looks like a bug here. I solved it with the following code and it works perfectly. Just comment out the suggested line in the docs and add another line to load the package from a CDN.

const map: any = {
  //'angular2-google-maps': 'node_modules/angular2-google-maps'
  'angular2-google-maps':   'https://npmcdn.com/angular2-google-maps@0.12.0'
};
0reactions
victorcuicommented, Nov 21, 2016

Hi, after change the map, i am getting:

Redirect from 'https://npmcdn.com/angular2-google-maps@0.16.0/core/' to 'https://unpkg.com/angular2-google-maps@0.16.0/core/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.

can you help me to fix this? thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

GET: angular2-google-maps/core 404 (Not Found) · Issue #480
Issue description Error in browser console and angular2 app not working after adding angular2-google-maps: GET ...
Read more >
javascript - Angular 2 - 404 page not displaying - Stack Overflow
Replace your app.routes.ts file with following code: import { Routes, RouterModule } from "@angular/router"; import { AboutPageComponent } ...
Read more >
SebastianM/angular2-google-maps - Gitter
When I npm start, the browser still report : system.src.js:1154 GET http://localhost:3002/angular2-google-maps/core 404 (Not Found). enclosed please find ...
Read more >
Overview | Maps JavaScript API - Google Developers
Get started with the Google Maps JavaScript API. View a simple example, learn the concepts, and create custom maps for your site.
Read more >
Google Maps and Angular - Pablo Ezequiel Inchausti
I will try to integrate Google Maps in a typical Angular App. I will use https://angular-maps.com/ and let see whats ... With the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found