react-google-maps
react-google-maps copied to clipboard
Module not found: Can't resolve 'react-google-maps'
Hi there
I get this message and I don't know why:
Module not found: Can't resolve 'react-google-maps' in '/usr/src/app/src/components'
I tried to delete node_modules folder, tried various versions of your library but it didn't help. Curently I use React 16.4.0 and react-google-maps 9.4.5. I don't use typescript as the other users with the same problem.
could you post your code, especially how you imported 'react-google-maps' in your code
same issue here.. Just installed react-google-maps fresh first time by npm i react-google-maps
Same here : ` import React from 'react'; import GoogleMapReact from 'google-map-react'; import data from '../../food_trucks.json';
const AnyReactComponent = ({ text }) =>
class Map extends React.Component { constructor(props) { super(props); this.state = { places: data, }; this.props = { center: { lat: 59.95, lng: 30.33 }, zoom: 11 }; this.props.center.lat = this.state.places.coordonnees_wgs84.lat; this.props.center.lat = this.state.places.coordonnees_wgs84.lon; }
render() {
return (
<div style={{ height: '100vh', width: '100%' }}>
<GoogleMapReact
bootstrapURLKeys={{ key: '' }}
defaultCenter={this.props.center}
defaultZoom={this.props.zoom}
>
<AnyReactComponent
lat={59.955413}
lng={30.337844}
text="My Marker"
/>
</GoogleMapReact>
</div>
);
}
}
export default Map; ` And my package.json :
{ "name": "react-lab", "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "^4.5.0", "@material-ui/icons": "^4.4.3", "google-maps-react": "^2.0.2", "react": "^16.10.2", "react-dom": "^16.10.2", "react-redux": "^7.1.1", "react-scripts": "3.2.0", "recharts": "^1.7.1", "redux": "^4.0.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }
@banibanc The repo of this project is unmaintained more than a year, and we had build new version https://www.npmjs.com/package/@react-google-maps/api
We had rewrite it to TypeScript, and updating it frequently: https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api You can enjoy autocomplete.
You can see our docs: https://react-google-maps-api-docs.netlify.com/
Also a lot of examples: https://react-google-maps-api-gatsby-demo.netlify.com/ https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api-gatsby-example/src/examples
The bundle size is much smaller: https://bundlephobia.com/result?p=@react-google-maps/[email protected]
Enjoy!
Thanks !
@banibanc The repo of this project is unmaintained more than a year, and we had build new version https://www.npmjs.com/package/@react-google-maps/api
We had rewrite it to TypeScript, and updating it frequently: https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api You can enjoy autocomplete.
You can see our docs: https://react-google-maps-api-docs.netlify.com/
Also a lot of examples: https://react-google-maps-api-gatsby-demo.netlify.com/ https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api-gatsby-example/src/examples
The bundle size is much smaller: https://bundlephobia.com/result?p=@react-google-maps/[email protected]
Enjoy!
Hello there,
I cannot load the map, with error msg Module not found: Can't resolve '@react-google.maps/api' in
I installed via yarn add @react-google-maps/api
This is on a newly created react project app. React v: 16.10.2
npm i react-google-maps --force