You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

react-mapbox-gl中Marker不显示问题求助

react-mapbox-gl中Marker不显示问题求助

大家好,我正在尝试集成react-mapbox-gl到项目里,但遇到了一个棘手的问题——地图上的Marker标记完全不显示,想请各位大佬帮忙排查下原因!

我整理了项目的配置信息,下面是package.json的内容:

{
  "name": "mapbox-poc",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "mapbox-gl": "^2.2.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-mapbox-gl": "^5.1.1",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

目前我已经确认地图本身能正常加载,只是Marker标记死活不出来。我怀疑是不是组件的使用方式有误,或者依赖版本之间存在兼容性问题?有没有朋友遇到过类似的情况,能给我一些排查方向或者解决建议吗?

备注:内容来源于stack exchange,提问作者praveenkumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 11:04:38