node-modules - 找不到 react-google-maps 模块:无法解析“react-google-maps/lib/places/SearchBox”
问题描述
我有一个使用react-google-maps的 create-react-app 。我想要做的是从“react-google-maps/lib/places/SearchBox”导入 SearchBox,但出现以下错误:
Module not found: Can't resolve 'react-google-maps/lib/places/SearchBox' in 'D:\ReactApp\demo\src\components'
import React from 'react';
import { withScriptjs, withGoogleMap, GoogleMap, Marker } from "react-google-maps"
import SearchBox from 'react-google-maps/lib/places/SearchBox';
其他进口正常。当我从子目录即 /node_modules/react-google-maps/lib/... 导入模块时,似乎会出现问题。
解决方案
尝试使用这个:
yarn add react-google-maps-loader --windows
npm install react-google-maps-loader --save
和
yarn add react-google-maps-loader --windows
npm install react-google-maps-loader --save
推荐阅读
- list - “这不是记录”-尝试对列表进行排序时出错
- javascript - 使用 JS 和 VBA 将空白文本框添加到 Abobe Acrobat PDF
- json - 去 openweathermap 预测返回类型
- css - 如何使 2 个 div 具有相同的高度,一个图像(没有 javascript)?
- authentication - Web 应用程序的开箱即用身份验证解决方案?
- pandas - 计算最近出现的状态 - Pandas
- node.js - TypeError:无法读取 null 的属性“findById”
- matter.js - 为什么当我输入一个值时不旋转一个对象的角度
- javascript - Gulp 4 Sass + BrowserSync 注入与 MAMP
- r - 是否可以将地图从 esri 休息服务器导入 R 作为简单的特征对象?