googlemaps / google-maps-services-js

Node.js client library for Google Maps API Web Services
Apache License 2.0
2.89k stars 639 forks source link

Cannot find module 'core-js/modules/es.string.replace.js' #1182

Closed hcancelik closed 6 months ago

hcancelik commented 6 months ago

Currently getting the following error from this library

Cannot find module 'core-js/modules/es.string.replace.js' from 'node_modules/@googlemaps/url-signature/dist/index.umd.js'

Environment details

  1. Specify the API at the beginning of the title (for example, "Places: ..."): Library
  2. OS type and version: Node
  3. Library version and other environment information 3.3.42

Code example

const { Client } = require("@googlemaps/google-maps-services-js");

Stack trace

 Require stack:
        node_modules/@googlemaps/url-signature/dist/index.umd.js
        node_modules/@googlemaps/google-maps-services-js/dist/serialize.js
        node_modules/@googlemaps/google-maps-services-js/dist/directions.js
        node_modules/@googlemaps/google-maps-services-js/dist/client.js
        node_modules/@googlemaps/google-maps-services-js/dist/geolocate.js
        node_modules/@googlemaps/google-maps-services-js/dist/index.js

Thanks!

wangela commented 6 months ago

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@hcancelik Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

hcancelik commented 6 months ago

Looking closely at the issue, this is related to the URL signature package.

There is an open ticket here, so I'm closing this one.

https://github.com/googlemaps/js-url-signature/issues/528

Politta commented 6 months ago

Shouldn't it have pinned dependencies to avoid issues like that going forward?

TimJohns commented 6 months ago

Confirming, cross-posting, and summarizing some workarounds from the https://github.com/googlemaps/js-url-signature/issues/528 issue thread, npm users can override the upstream js-url-signature version to the 1.0.32 version:

  "overrides": {
    "@googlemaps/url-signature": "1.0.32"
  }

Similarly it appears that users of other package managers (presumably pnpm or yarn) can use the following, but I have not personally confirmed:

"resolutions": {
  "@googlemaps/url-signature": "1.0.32"
}

Alternately, you could add "core-js" explicitly as a dev dependency (also confirmed works in our use case):

npm install core-js --save-dev

That said, these are essentially just temporary workarounds already suggested by others in the https://github.com/googlemaps/js-url-signature/issues/528 issue thread that I am cross-posting here for convenience and confirming worked for my team -- but my own team's actual plan is to just wait a bit for a fix, so that we don't have to remember to pull these out when js-url-signature is presumably updated.

3DGISKing commented 5 months ago

same for me