【问题标题】:react-google-maps Module not found: Can't resolve 'react-google-maps/lib/places/SearchBox'找不到 react-google-maps 模块:无法解析“react-google-maps/lib/places/SearchBox”
【发布时间】:2019-10-12 23:48:06
【问题描述】:

我有一个使用 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/....)导入模块时,似乎会出现问题。

【问题讨论】:

    标签: node-modules create-react-app react-google-maps


    【解决方案1】:

    尝试使用这个:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-21
      • 2017-02-17
      • 2021-11-24
      • 1970-01-01
      • 2018-02-19
      • 1970-01-01
      相关资源
      最近更新 更多