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.

Cannot read property 'extend' of undefined

See original GitHub issue

I load these scripts in my head:

 <script src="js/jquery.min.js" defer></script>
 <script src="https://unpkg.com/leaflet@latest/dist/leaflet.js" defer></script> 
 <script src="https://unpkg.com/leaflet-control-geocoder@latest/dist/Control.Geocoder.js"></script>
 <script src="js/siteworks.js" defer></script>

I create a map which is displayed correctly and when I add the geocoder L.Control.geocoder().addTo(map); I get this error:

Uncaught TypeError: Cannot read property 'extend' of undefined at nominatim.js:5 at index.js:42

nominatim.js:

import L from 'leaflet';
import { template, getJSON } from '../util';

export default {
  class: L.Class.extend({          <--
    options: {
    .
    .
    .

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
googlsuxcommented, Jan 11, 2019

This has nothing to do with the other scripts eg. siteworks. Even a minimal HTML that does nothing shows this error after load in Chrome console:

<!DOCTYPE html>
<html>
    <head>
	<link rel="stylesheet" href="https://unpkg.com/leaflet@latest/dist/leaflet.css" />
	<link rel="stylesheet" href="Control.Geocoder.css" />
	<script src="Control.Geocoder.js"></script>
	<script src="https://unpkg.com/leaflet@latest/dist/leaflet-src.js"></script>
    </head>
    <body>
    </body>
</html>

Result:

nominatim.js:5 Uncaught TypeError: Cannot read property ‘extend’ of undefined at nominatim.js:5 at index.js:42

Very unprofessional, what is the source of this problem??

1reaction
perliedmancommented, May 11, 2020

@leonheess Yeah, sorry about closing it abruptly, but if you read my response, it says:

I suspect a similar problem in the first case: L.Class.extend is a function in Leaflet, it’s not something that this plugin has invented.

And I stand by the important part: without a reproducible, running example, it is usually impossible as a maintainer to find out what is happening. A few <script> tags and an error message is rarely enough, unless it’s a problem you have seen before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'extend' of undefined #61
Looks like super does not exist in Ctor (and Ctor is the Vue constructor function). I'm using Vue 2.5.2.
Read more >
Uncaught TypeError: Cannot read properties of undefined ...
In vue 3 there's no exported member called Vue , the right code that's equivalent for Vue.extend is : import { defineComponent }...
Read more >
Vue can not read property 'extend' of undefined from library ...
[Solved]-Vue can not read property 'extend' of undefined from library-Vue.js. Search. score:0. Try exporting it as a function that returns Vue.extend()
Read more >
TypeError: Cannot read property 'extend' of undefined - Browser
?Hi @BLeahy - This typically occurs when one of the objects you are accessing in the Synthetic script is null or undefined. If...
Read more >
Cannot read property 'extend' of undefined - Mobiscroll
Cannot read property 'extend' of undefined ... Hi there. We recently downloaded Calendar as component with ES6 modules. In the AppModule we ...
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