jupyterlab/jupyter-renderers

SOLVED: GeoJSON -- TypeError: Cannot read property 'DomEvent' of undefined

consideRatio opened this issue · 2 comments

Opening .geojson files or running the code examples from the GeoJSON README.md previously worked, but now doesn't. Something broke after rebuilding my Dockerimage without strict dependency pinning, so I assume it has to do with GeoJSON being incompatible with something that was upgraded, for example leaflet` or jupyterlab?

Errors in browser console

For every time I try to open a .geojson file or run an example this happens in the browser console logs, no other indication of error is presented except that we no longer get any rendered output.

TypeError: Cannot read property 'DomEvent' of undefined
TypeError: Cannot read property 'DomEvent' of undefined
    at NewClass.addHooks (leaflet.draw.js:9)
    at NewClass.enable (leaflet-src.js:5722)
    at NewClass.addHandler (leaflet-src.js:3736)
    at NewClass.init (leaflet-src.js:385)
    at NewClass.proto.callInitHooks (leaflet-src.js:357)
    at NewClass.initialize (leaflet-src.js:3148)
    at new NewClass (leaflet-src.js:301)
    at Object.createMap [as map] (leaflet-src.js:4709)
    at new RenderedGeoJSON (index.js:66)
    at Object.createRenderer (index.js:145)
    at RenderMimeRegistry.createRenderer (registry.js:106)
    at OutputArea.createRenderedMimetype (widget.js:370)
    at OutputArea.createOutputItem (widget.js:347)
    at OutputArea._insertOutput (widget.js:332)
    at OutputArea.onModelChanged (widget.js:217)
    at invokeSlot (index.js:475)

My environment

$ jupyter --version
4.4.0
$ jupyter lab --version
0.35.4
$ jupyter notebook --version
5.7.6

I've also installed:

  • ipyleaflet from conda
  • jupyter-leaflet as a jupyter labextension install

All my JupyterLab extensions

# JupyterLab extensions
RUN export NODE_OPTIONS="--max-old-space-size=4096" \
 && jupyter labextension install \
        @jupyter-widgets/jupyterlab-manager \
        @jupyter-widgets/jupyterlab-sidecar \
        @jupyterlab/celltags \
        @jupyterlab/fasta-extension \
        @jupyterlab/geojson-extension \
        @jupyterlab/hub-extension \
        @jupyterlab/latex \
        @jupyterlab/plotly-extension \
        # @jupyterlab/shortcutui \
            # https://github.com/jupyterlab/jupyterlab-shortcutui/issues/44
        @jupyterlab/statusbar \
        @jupyterlab/toc \
        @jupyterlab/vega3-extension \
        @mflevine/jupyterlab_html \
        # jupyterlab_iframe \
        # qgrid \
        bqplot \
        dask-labextension \
        ipyvolume \
        jupyter-leaflet \
        jupyter-matplotlib \
        jupyter-threejs \
        jupyterlab_bokeh \
        jupyterlab_tensorboard \
        jupyterlab-chart-editor \
        jupyterlab-drawio \
        jupyterlab-kernelspy \
        nbdime-jupyterlab \
        plotlywidget \
 && jupyter lab clean \
 && jlpm cache clean \
 && npm cache clean --force \
 && rm -rf $HOME/.node-gyp \
 && rm -rf $HOME/.local \
 && fix-permissions $CONDA_DIR $HOME \
 && unset NODE_OPTIONS
# browser log message on startup of the notebook server
Existing `L` detected, running ipyleaflet's Leaflet in no-conflict mode as `ipyL`

# browser log message after opening a .geojson file 
Uncaught TypeError: Cannot read property 'DomEvent' of undefined

# the error triggers on the following JS code in leaflet.draw.js
L.DomEvent.on(this._container,"touchstart",this._onTouchStart,this)

Is it because I install jupyter-leaflet alongside the @jupyterlab/geojson-extension?

Bingo! That was why! Removing jupyter-leaflet did the trick. So the conclusion is: don't install both these extensions.

Question remains though...

Is geojson-extension something that contains strictly more functionality, or am I missing out on something not having jupyter-leaflet if I'm using the geojson extension?

This issue may no longer be an issue: jupyter-widgets/ipyleaflet#337