Smit Gajera
Smit Gajera

Reputation: 1039

`react-map-gl` ERROR Module not found error [MAPBOX]

Failed to compile
./node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js
Module not found: Can't resolve 'gl-matrix/mat4' in 'D:\Projects\react-app\frontend\node_modules\@math.gl\web-mercator\dist\esm'+

I get this on the development status, I tried repeatedly to install and uninstall npm i react-map-gl. I also tried to create a new app but facing same error.

Upvotes: 2

Views: 7066

Answers (3)

Youssifou Awanou
Youssifou Awanou

Reputation: 71

Installation
Using react-map-gl requires react >= 16.3.

npm install --save react-map-gl mapbox-gl

Upvotes: 1

dain
dain

Reputation: 6689

I had the same issue and in the end had to add gl-matrix as an explicit dependency:

npm install gl-matrix

Upvotes: 2

Berk Özel
Berk Özel

Reputation: 607

The issue is basically one of the dependencies of react-map-gl which is called gl-matrix has upgraded to version 3.4.0 from 3.3.0. Probably because it is a minor upgrade some of its dependant libraries

    ├─┬ [email protected]
│ └── [email protected] 
├─┬ [email protected]
│ └─┬ [email protected]
│   └─┬ @math.gl/[email protected]
│     └── [email protected]  deduped
└─┬ [email protected]
  └── [email protected] 

automatically tried to fetch latest minor version. I'm trying force-resolutions with npm both on docker as well.

You can check which version your packages are using with

- npm ls gl-matrix

then try

- npm install --unsafe-perm to force resolutions if necessary.

Upvotes: 2

Related Questions