首页 > 解决方案 > 电子地理定位网络位置提供商

问题描述

所以我有这个代码:

navigator.geolocation.getCurrentPosition(console.log, console.error, {timeout:5000});

并返回以下错误:

GeolocationPositionError {code: 2, message: "Network location provider at 
'https://www.googleapis.com/' : No response received."}
code: 2 message: "Network location provider at 'https://www.googleapis.com/' : No response received."

我似乎没有找到任何解决方案。我已经尝试设置process.env.GOOGLE_API_KEY = config.GoogleAPIKeys.GeolocationAPI;(配置部分是正确的,我仔细检查了它)

而且我还切换到 ssl (https) 并添加了这个以便电子显示它 app.commandLine.appendSwitch('ignore-certificate-errors', 'true');

提前致谢!

标签: node.jsexpresselectron

解决方案


推荐阅读