簡體   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