Open abdirahmn1 opened 5 months ago
@abdirahmn1 Thank you for opening this issue. π Please check out these other resources that might help you get to a resolution in the meantime:
google-maps
tagThis is an automated message, feel free to ignore.
Same error on node v20 and osx
Same error on node v20 and osx
Found a solution?
Same error on node v20 and osx
Found a solution?
You can simply npm install --save core-js@3.37.0
to get rid of the problem temporarily
Another solution is to add the following code to the package.json
:
"overrides": {
"@googlemaps/url-signature": "1.0.32"
}
Why don't maintainers create patch version to fix this issue? It is so discouragement to face error at the first time rather than getting response for GOOGLE MAP official sdk.
Why don't maintainers create patch version to fix this issue? It is so discouragement to face error at the first time rather than getting response for GOOGLE MAP official sdk.
Feel free to contribute. It's open source :)
Same error on node v20 and osx
Found a solution?
You can simply
npm install --save core-js@3.37.0
to get rid of the problem temporarily
This worked for me
"Technically" this is a dupe of #1182, which was closed, but I'd recommend keeping this one open until the upstream releases are fixed, so that it's easier for folks to find this, and not open additional new issues.
In any case, despite the fact that google-maps-services-js is featured prominently in the call stack, 1.0.33 release requires core-js but states no dependency #528 is a little closer to the root cause, and might be a good place for additional upvotes and commentary.
In terms of @justAsascha's recommendation to make a contribution since it's Open Source, I took a full day to take a crack at it, and if I tracked it down correctly, I believe the issue is that in js-url-signature, babel is determining that core-js is required for a couple of polyfills (including es.string.replace) for older browser support. I removed core-js from the .babelrc and it all worked great FOR ME (Nodejs 20 environment), but that's pretty clearly a build config/release business decision more than a code fix. In my own personal opinion, completely removing the core-js dependency is slightly preferable, since older browsers could still use older versions explicitly, and the rest of us would have one less dependency, but that's definitely a business decision.
I conjecture someone could alternately move core-js from devDependencies to dependencies in the package.json for js-url-signature; but I didn't try that. If anyone does, tag me in the PR and I'm happy to pull it down and test here, comment, etc. Or if I run out of stuff to do and can spare another day (ha!) I'll take another crack at it.
Based on 1.0.33 release requires core-js but states no dependency #528, it sounds like folks are aware of it, but not sure who owns that decision. I recommend upvoting there.
This answer works if you don't want to install a specific version as suggested above. https://stackoverflow.com/a/72555437/14804912
After searching a lot, what works for me was what I found in this blog post:
https://blog.csdn.net/Missbelover/article/details/123221351
Basically, what you need to do is...
Remove all your node_modules dependencies.
npm rm -rf node_modules
Install core-js first.
npm install --save core-js
Finally install everything else.
npm install
yarn install
After this everything should work as expected, a least for me is working now.
Have a good day!
Thanks to Gustavo Villarroel C from Stack Overflow!
There has been a PR to fix this issue in the underlying package here since early May. Unfortunately, there appears to be limited activity in that package compared to this one. I would encourage giving this Issue a π so that a review of that PR gets prioritized, as this is breaking the upgrade path for this library for some folks.
(Edit: I meant to give the π to the first post here - the issue itself. Google has in the past said they prioritize by those emoji on the top post.)
There has been a PR to fix this issue in the underlying package here since early May. Unfortunately, there appears to be limited activity in that package compared to this one. I would encourage giving this Issue a π so that a review of that PR gets prioritized, as this is breaking the upgrade path for this library for some folks.
π
for deno users - npm:@googlemaps/google-maps-services-js@3.2.6
works for me
Looks like a new @googlemaps/url-signature (1.0.35) was released last night, but appears it did not include @zackdotcomputer's PR and still shows the issue in my environment. 1.0.33 release requires core-js but states no dependency #528:
Error: Cannot find module 'core-js/modules/es.string.replace.js'
Require stack:
- /Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/url-signature/dist/index.umd.js
- /Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/google-maps-services-js/dist/serialize.js
- /Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/google-maps-services-js/dist/directions.js
- /Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/google-maps-services-js/dist/client.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at /Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/url-signature/dist/index.umd.js:1:79
at Object.<anonymous> (/Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/url-signature/dist/index.umd.js:1:807)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/url-signature/dist/index.umd.js',
'/Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/google-maps-services-js/dist/serialize.js',
'/Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/google-maps-services-js/dist/directions.js',
'/Users/tjohns/Src/epic-roadtrip-planner/node_modules/@googlemaps/google-maps-services-js/dist/client.js'
]
}
Node.js v21.2.0
From package-lock.json:
"node_modules/@googlemaps/url-signature": {
"version": "1.0.35",
"resolved": "https://registry.npmjs.org/@googlemaps/url-signature/-/url-signature-1.0.35.tgz",
"integrity": "sha512-UvDUghW8bJTVSGb0G4j2eEIsUWCdVXRZlhxeCT/ZmG44lebW85v716L0ExO/m1or2DKswsZ+Bx6UUwSHDDHsIw==",
"dependencies": {
"crypto-js": "^4.2.0"
}
},
Only way I've been able to get this to deploy is by switching to the deprecated Google Maps
npm uninstall @googlemaps/google-maps-services-js
npm install @google/maps
I'm not sure if this is advisable, but wanted to add this data point.
Very interested in better understanding what's going on here
FYI - I'm no longer seeing the error in my environment as of the 1.0.36 release of @googlemaps/url-signature
From my latest package-lock.json:
"node_modules/@googlemaps/url-signature": {
"version": "1.0.36",
"resolved": "https://registry.npmjs.org/@googlemaps/url-signature/-/url-signature-1.0.36.tgz",
"integrity": "sha512-BTYFuGr+DRziXiHUR0xok4t2C8apTL2plSi/ouB7yVAPxv5qiHJ05v0gO98kXfhj4r63J1ZDNku65nH/GH9T0A==",
"dependencies": {
"crypto-js": "^4.2.0"
}
},
Cross-posted from 1.0.33 release requires core-js but states no dependency #528:
I now have no overrides or core-js in my package.json. I attempted to repro in Node v21.2.0 (where I most recently confirmed I was still seeing it) and v22.4.1 (npm v10.8.1), my current environment. I'm still tying to track down the specific change that may have resolved this for me, but I'm currently lost in the details of the latest babel environment updates, and I got a little excited, so figured I'd jump over here and add a comment here real quick before digging in further.
Can anyone confirm this is resolved and/or have details of what theoretically resolved it? Fingers crossed (and thanks!)
Am encountering the error code
MODULE_NOT_FOUND
after updating the package to latest/@3.4.0, this didn't exist about 3 weeks ago. It seems to be a problem withcore-js
missing, temporarilly installingcore-js
seems to solve the problem.Environment details
Steps to reproduce
Code example
Stack trace
Hopefully this gets fixed soon. :+1: