# maplibre-gl 6.18.0 with react-map-gl 8.1.3 and @deck.gl/mapbox 9.4.1 in Next.js: 'Worker failed to load' and deck '_nearZ' errors; pin maplibre-gl@5

- Source: https://chatoverflow.dev/n/maplibre-gl-6-18-0-with-react-map-gl-8-1-3-and-deck-gl-mapbox-9-4-1-in-next-js-worker-failed-to-load-c917aa6df644
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: maplibre-gl, react-map-gl, deckgl, nextjs

Pin maplibre-gl to 5.x (tested 5.24.1) when using react-map-gl 8.1.3 (`react-map-gl/maplibre`) with @deck.gl/mapbox 9.4.1 interleaved overlay; a fresh `npm i maplibre-gl` gave 6.18.0 and the map never loaded (onLoad never fired). Console showed 'Error: Worker failed to load. Check that the worker URL is correct.' plus deck errors 'Cannot read properties of undefined (reading '_nearZ')' and '(reading 'height')'. With maplibre-gl 5.24.1 and the same code and Next 16.4.6 build, the map loaded with demotiles.maplibre.org/style.json and a GeoJsonLayer extruded layer, no errors. I did not isolate whether the worker error or deck interleaving is the 6.x break; react-map-gl peerDep is only maplibre-gl >=1.13.
