Renfri
Renfri

Reputation: 43

Not installed react-leaflet library

When I trying to import a library "react-leaflet", I get this error:

ERROR in ./node_modules/react-leaflet/lib/propTypes/map.js
Module not found: Error: Can't resolve 'leaflet' in 'D:\PycharmProjects\adminora\node_modules\react-leaflet\lib\propTypes'
@ ./node_modules/react-leaflet/lib/propTypes/map.js 5:15-33
@ ./node_modules/react-leaflet/lib/Map.js
@ ./node_modules/react-leaflet/lib/index.js

EDIT: My package.json file:

  "dependencies": {
    "@types/react": "^16.0.36",
    "babel-polyfill": "^6.26.0",
    "classnames": "^2.2.5",
    "history": "^4.7.2",
    "jwt-decode": "^2.2.0",
    "material-ui": "^1.0.0-beta.27",
    "material-ui-icons": "^1.0.0-beta.17",
    "prop-types": "^15.6.0",
    "react": "^16.2.0",
    "react-block-ui": "^1.1.1",
    "react-dom": "^16.2.0",
    "react-leaflet": "^1.8.1",
  }

Upvotes: 2

Views: 4133

Answers (2)

Javed Shaikh
Javed Shaikh

Reputation: 681

delete node_modules folder and package-lock.json file and try below commands.

npm install
npm install leaflet react-leaflet --save

Upvotes: 2

AlexVestin
AlexVestin

Reputation: 2586

You need to install the dependency packages aswell, try using

npm install leaflet prop-types react react-dom react-leaflet

Upvotes: 7

Related Questions