找不到模块“react-map-gl-geocoder”的声明文件;

发布于 2025-01-13 07:15:27 字数 1658 浏览 0 评论 0原文

您好,我正在尝试在我的反应项目中使用 Mapbox 地理编码器。我总是遇到这两个错误。

找不到模块“react-map-gl-geocoder”的声明文件。 'Git/react-excercises/node_modules/react-map-gl-geocoder/dist/index.js' 隐式具有“any”类型。 尝试 npm i --save-dev @types/react-map-gl-geocoder 如果存在,或者添加一个包含声明模块“react-map”的新声明 (.d.ts) 文件-gl-geocoder';ts(7016)

./node_modules/react-map-gl-geocoder/dist/index.m.js 尝试导入错误:“FlyToInterpolator”未从“react-map-gl”导出(导入为“r”)。

这是我的 package.json

{
  "name": "react-excercises",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "axios": "^0.26.0",
    "bootstrap": "^5.1.3",
    "mapbox": "^1.0.0-beta10",
    "mapbox-gl": "^2.7.0",
    "mapbox-gl-geocoder": "^2.0.1",
    "prop-types": "^15.8.1",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-icons": "^4.3.1",
    "react-map-gl": "^7.0.9",
    "react-map-gl-geocoder": "^2.2.0",
    "react-mapbox-gl-geocoder": "^1.1.0",
    "react-scripts": "4.0.3",
    "reactstrap": "^9.0.1",
    "styled-components": "^5.3.3",
    "web-vitals": "^1.1.2"
  },
  "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"
    ]
  }
}

Hi I am trying to use Mapbox geocoder for my react-project. I am always getting those two errors.

Could not find a declaration file for module 'react-map-gl-geocoder'. 'Git/react-excercises/node_modules/react-map-gl-geocoder/dist/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/react-map-gl-geocoder if it exists or add a new declaration (.d.ts) file containing declare module 'react-map-gl-geocoder';ts(7016)

./node_modules/react-map-gl-geocoder/dist/index.m.js
Attempted import error: 'FlyToInterpolator' is not exported from 'react-map-gl' (imported as 'r').

This is my package.json

{
  "name": "react-excercises",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "axios": "^0.26.0",
    "bootstrap": "^5.1.3",
    "mapbox": "^1.0.0-beta10",
    "mapbox-gl": "^2.7.0",
    "mapbox-gl-geocoder": "^2.0.1",
    "prop-types": "^15.8.1",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-icons": "^4.3.1",
    "react-map-gl": "^7.0.9",
    "react-map-gl-geocoder": "^2.2.0",
    "react-mapbox-gl-geocoder": "^1.1.0",
    "react-scripts": "4.0.3",
    "reactstrap": "^9.0.1",
    "styled-components": "^5.3.3",
    "web-vitals": "^1.1.2"
  },
  "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"
    ]
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文