gpt4 book ai didi

reactjs - 找不到模块 : Can't resolve 'react-leaflet'

转载 作者:行者123 更新时间:2023-12-05 00:58:40 29 4
gpt4 key购买 nike

在尝试运行一些示例代码时,出现编译错误;

"Module not found: Can't resolve 'react-leaflet' in 'C:\Users...\my-app\src\map'"

我正在尝试使用 react 和 typecipt 来做到这一点,并使用“react-leaflet”

我已经尝试安装 types@react-leaflet 和 react-leaflet 了

这是我的依赖项:

"dependencies": {
"@types/jest": "24.0.15",
"@types/leaflet": "^1.4.4",
"@types/node": "12.0.8",
"@types/react": "16.8.20",
"@types/react-dom": "16.8.4",
"@types/react-leaflet": "^2.2.1",
"leaflet": "^1.5.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
"save": "^2.4.0",
"typescript": "3.5.2"
}

最佳答案

你还没有添加 react-leaflet 依赖,只添加了类型。

运行 npm i react-leaflet 来安装实际的包。

关于reactjs - 找不到模块 : Can't resolve 'react-leaflet' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56685584/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com