繁体   English   中英

未安装 react-leaflet 库

[英]Not installed react-leaflet library

当我尝试导入库“react-leaflet”时,出现此错误:

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

编辑:我的 package.json 文件:

  "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",
  }

您还需要安装依赖包,请尝试使用

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

删除 node_modules 文件夹和 package-lock.json 文件并尝试以下命令。

npm install
npm install leaflet react-leaflet --save

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM