Google maps is not shown on the server but on the local


I want to show a map with some locations for this I use the library gmaps js link

And everything works fine on my computer, but when I upload it to my server it sends me the following error


common.js: 48 Uncaught TypeError: Can not read property 'prototype' of undefined

If I upload my code to the jsfiddle if it works well. I do not know why on my server he sent me that error. I tried a free hosting and the map is also seen correctly

This is the example of my code link

Thank you to whoever responded, but the problem is not that. Here is another test I did

<!DOCTYPE html> <!-- archivo completo -->
    <style type="text/css">
#maps {
    display: block;
    width: 100%;
    height: 100%;

#maps {
    background: #58B;

    <script type="text/javascript" src="assets/plugins/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="assets/plugins/gmaps/gmaps.js"></script> 
    <script type="text/javascript">

    $(document).ready(function() {

        map = new GMaps({
        div: '#maps',
        lat: 38.542982,
        lng: -90.16917,
        scrollwheel: false,
        zoom: 11

        lat: 38.5778969,
        lng: -89.9878952,
        verticalAlign: 'top',
        title: 'Ceremony Location',  
        infoWindow: {
            content: '<div class="note">Ceremony</div><h4 class="map-title script">Grace Church</h4><div class="address"><span class="region">5151 N Illinois St</span><br><span class="postal-code">Fairview Heights IL</span><br><span class="city-name">62208</span></div>'


        lat: 38.5083615,
        lng: -90.2969051,
        title: 'Reception Location',      
        infoWindow: {
            content: '<div class="note">Reception</div><h4 class="map-title script">Royals Orleans</h4><div class="address"><span class="region">2801 Telegraph Rd</span><br><span class="postal-code">Saint Louis, MO</span><br><span class="city-name">63125</span></div>'


    <div id="maps" class="map-container">

This file works perfectly on my computer.

If I upload it to my server server link It does not work. This error appears:

And in the console it shows

 Uncaught TypeError: Cannot read property 'prototype' of undefined 
 Google Maps API warning: NoApiKeys

As you can see, if you do not have the KEY API, it's just a warning, try to upload it with the KEY API and it does not work either.

The weird thing is that the error sends it in a Javascript called common.js that I do not have imported, as if it were loaded dynamically from somewhere.

This is the debug of my team, as you can see the file is local

and this is the production server

Since javascript is minimized, it is impossible to know what it does.

They could help me.

asked by ERIDOM 06.07.2016 в 06:07

3 answers


What you need is to add a key to use the api

When you do this

<script src=""></script>

It should be something like that

<script src=""></script>

You can take the key out by creating an app on google and do not forget to give it the permissions.

answered by 07.07.2016 в 09:19

In your html you show in jsfiddle you can only see the div. In the version that you have in your server if you have not put it you should put:

<script src=""></script>

It is essential for everything to work well.
And obviously the path to: gmaps.js on your server.

I've done a test uploading everything to my server and it works well for me. I copy the code that I have used, I have simply referenced what it asks for. I have not bothered to put the js in the folder but you can do it.

I have used the example html file: basic.html and I have simply added these references by adding those files.

  <script type="text/javascript" src="gmaps.js"></script>
  <script type="text/javascript" src="gmaps.min.js"></script>
  <script type="text/javascript" src="gruntfile.js"></script>

If it still does not work, it should be a server problem. I hope to help you with this.

answered by 06.07.2016 в 09:02

1.- Go to: link

2.- Select: Google Maps JavaScript API

3.- Go down to "Quick start steps" and select: "GET A KEY"

4.- Follow the steps, you will generate a key, this you add it like this:

<script src="" type="text/javascript"></script>
answered by 17.08.2016 в 09:00