The official google maps package (@google/maps) is for node only. In a browser environment, you need to use an unofficial package or include the official script on your site.

To the ReferenceError problem, make sure the script tag for google maps is above the script tag for your code so that it loads first. If it isn't, your script may run before the google global variable is created.

One unofficial package is google-maps, which can be used in a browser.

Answer from pfg on Stack Overflow
🌐
npm
npmjs.com › package › google-maps
google-maps - npm
September 28, 2020 - Async loader for google maps api (browser, typescript). Latest version: 4.3.3, last published: 6 years ago. Start using google-maps in your project by running `npm i google-maps`. There are 235 other projects in the npm registry using google-maps.
      » npm install google-maps
    
Published   Sep 28, 2020
Version   4.3.3
Discussions

What is the best npm package for the google map api?
I suggest just using the google maps API directly. The React wrappers available just don't really seem to capture all of the stuff you can do with the API. The way you use google maps, as you noted, is mostly imperative/not react-y. I recommend you just make your own map component, use a ref, and bang it out. More on reddit.com
🌐 r/react
6
8
June 28, 2021
migrate agm/core to angular/google-maps

agm/core was last published 4 years ago. It no longer seems to be maintained. I would switch to angular/google-maps.

More on reddit.com
🌐 r/angular
1
1
March 27, 2024
Google Maps and ThreeJS - npm i @googlemaps/three

Published an initial version of https://www.npmjs.com/package/@googlemaps/three for combining ThreeJS and Google Maps. Check it out and let me know what you think.

More on reddit.com
🌐 r/threejs
5
4
June 3, 2021
Best React NPM package for Google Places Autocomplete?
Well if you're going to use Google then I certainly recommend using their official package. https://www.npmjs.com/package/@googlemaps/google-maps-services-js (says it's for Node but it works perfectly on web/native as well.) But if you are planning to have high usage, I recommend using another service like Mapbox. Once you get through Google's free tier, their prices are exorbitant for Places/Geocoding stuff. More on reddit.com
🌐 r/reactjs
7
11
August 31, 2021
🌐
npm
npmjs.com › package › @types › google.maps
@types/google.maps - npm
September 23, 2024 - npm install --save @types/google.maps · This package contains type definitions for google.maps (https://developers.google.com/maps/). Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/google.maps.
      » npm install @types/google.maps
    
🌐
npm
npmjs.com › package › @react-google-maps › api
@react-google-maps/api - npm
December 16, 2025 - Latest version: 2.20.8, last published: 4 months ago. Start using @react-google-maps/api in your project by running `npm i @react-google-maps/api`. There are 505 other projects in the npm registry using @react-google-maps/api.
      » npm install @react-google-maps/api
    
Published   Dec 16, 2025
Version   2.20.8
🌐
npm
npmjs.com › package › @google › maps
Node.js Client for Google Maps Services
April 30, 2020 - Latest version: 1.1.3, last published: 6 years ago. Start using @google/maps in your project by running `npm i @google/maps`. There are 184 other projects in the npm registry using @google/maps.
      » npm install @google/maps
    
Published   Apr 30, 2020
Version   1.1.3
Author   Google Inc.
🌐
GitHub
github.com › googlemaps › google-maps-services-js
GitHub - googlemaps/google-maps-services-js: Node.js client library for Google Maps API Web Services · GitHub
Node.js client library for Google Maps API Web Services - googlemaps/google-maps-services-js
Starred by 3K users
Forked by 649 users
Languages   TypeScript
🌐
npm
npmjs.com › package › @angular › google-maps
@angular/google-maps - npm
1 week ago - Angular Google Maps. Latest version: 21.2.2, last published: 7 days ago. Start using @angular/google-maps in your project by running `npm i @angular/google-maps`. There are 55 other projects in the npm registry using @angular/google-maps.
      » npm install @angular/google-maps
    
🌐
npm
npmjs.com › package › @googlemaps › google-maps-services-js
@googlemaps/google-maps-services-js - npm
July 6, 2025 - Start using @googlemaps/google-maps-services-js in your project by running `npm i @googlemaps/google-maps-services-js`. There are 250 other projects in the npm registry using @googlemaps/google-maps-services-js.
      » npm install @googlemaps/google-maps-services-js
    
Published   Jul 06, 2025
Version   3.4.2
Find elsewhere
🌐
Google
developers.google.com › google maps platform › web › maps javascript api › open source libraries
Open source libraries | Maps JavaScript API | Google for Developers
Web Components simplify map integration via a component library, installable with `npm i @googlemaps/extended-component-library`. The API can be dynamically loaded using `npm i @googlemaps/js-api-loader`. TypeScript support includes types and ...
🌐
npm
npmjs.com › package › googlemaps
googlemaps - npm
December 20, 2016 - A simple way to query the Google Maps API from Node.js. Latest version: 1.12.0, last published: 9 years ago. Start using googlemaps in your project by running `npm i googlemaps`. There are 30 other projects in the npm registry using googlemaps.
      » npm install googlemaps
    
Published   Dec 20, 2016
Version   1.12.0
Author   Colin Kennedy
🌐
React Map GL
visgl.github.io › get started
Get Started | React Google Maps
For the examples, this key has to be provided via an environment variable GOOGLE_MAPS_API_KEY, for example by putting your key into a file named .env in the directory: ... Once that is set up, run npm install followed by npm start to start the development server.
🌐
npm
npmjs.com › search
Google Maps - npm search
React hook for Google Maps Places Autocomplete.
🌐
Google Maps Platform
mapsplatform.google.com › google maps platform › resources › blog › introducing react components for the maps javascript api
Introducing React components for the Maps JavaScript API – Google Maps Platform
November 2, 2023 - The package contains React components that correspond to elements in the Maps JavaScript API and hooks to access the map instance and additional libraries, speeding up load times and making the overall codebase easier to manage. This package will allow developers to quickly and easily create web applications that have geospatial experiences while having the peace of mind that the library will be kept up to date. This library is available on npm as @vis.gl/react-google-maps.
🌐
Reddit
reddit.com › r/react › what is the best npm package for the google map api?
r/react on Reddit: What is the best npm package for the google map api?
June 28, 2021 -

Hey,

I have been recently working with "google-map-react "(https://www.npmjs.com/package//google-map-react), which I chose because it seemed to be the most popular google map react package. The way you setup markers and stuff like that is great, and pretty simple to understand. You can also directly load geojson files, which is nice. However more I work with it, more I feel like it is not very "reacty". It is probably just me not fully understanding how the package works yet, but I cannot understand how to draw polylines in a reacty way (as there is no polyline component).

Would you say that this is the best package to use to create a simple app that shows routes, with the ability of filter said routes?

Or should I choose something else?

I am wondering if it is just worth keep working with it, or just use something else.

🌐
npm
npmjs.com › package › @capacitor › google-maps
@capacitor/google-maps - npm
February 11, 2026 - An interface containing the options used when creating a map. For web, all the javascript Google Maps options are available as GoogleMapConfig extends google.maps.MapOptions.
      » npm install @capacitor/google-maps
    
Published   Feb 11, 2026
Version   8.0.1
Author   Ionic
🌐
npm
npmjs.com › package › @types › googlemaps
@types/googlemaps - npm
February 10, 2021 - This package contains type definitions for Google Maps JavaScript API (https://developers.google.com/maps/).
      » npm install @types/googlemaps
    
🌐
npm
npmjs.com › package › google-maps-api
google-maps-api - npm
Latest version: 2.0.1, last published: 10 years ago. Start using google-maps-api in your project by running `npm i google-maps-api`. There are 5 other projects in the npm registry using google-maps-api.
      » npm install google-maps-api
    
Published   Feb 17, 2016
Version   2.0.1
Author   Mikko Haapoja
🌐
Socket
socket.dev › npm › package › @types › google.maps
@types/google.maps - npm Package Security Analysis - Socket
September 23, 2024 - OpenLayers is an open-source JavaScript library for displaying map data in web browsers. It has a wide range of features for various map services, but it has a steeper learning curve compared to Google Maps. ... The npm package @types/google.maps receives a total of 5,326,720 weekly downloads.
🌐
Npm
npm.io › package › @google › maps
google/maps NPM
Use Node.js? Want to geocode something? Looking for directions? This library brings the Google Maps API Web Services to your Node.js application.