Google地图在本地工作但不在Heroku上工作

时间:2017-12-25 05:24:41

标签: reactjs google-maps heroku react-google-maps

我将一个反应应用程序部署到heroku但是地图没有显示。我收到这些错误消息:

Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys util.js:248:12

当我尝试将它包含在库中并使用index.html中的脚本标记加载时,我得到: You have included the Google Maps API multiple times on this page. This may cause unexpected errors. Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

注意:密钥限制设置为无。我想知道为什么它可以从localhost运行,但不能从heroku运行

1 个答案:

答案 0 :(得分:2)

只有当您的网站位于“localhost”时(因为它的开发模式并且“仅”从开发人员处获得),谷歌地图才允许您访问没有API密钥的谷歌地图,here您需要什么

相关问题