electron - 当 Apple 测试我的 macOS 应用程序时,他们没有获得打开本地 Webbserver 的权限
问题描述
我用 Electron 创建了一个 macOS 应用程序。如果我在本地构建并运行该应用程序,它可以毫无问题地运行。但是,当 Apple 尝试运行时,他们遇到了一个问题,导致他们出现此错误。
[2021-06-09 10:59:19.217] [info] ----------> start_server
[2021-06-09 10:59:19.218] [info] 3000
[2021-06-09 10:59:19.221] [info] Error while starting server: listen EPERM: operation not permitted 0.0.0.0:3000
[2021-06-09 10:59:19.222] [info] Error caught: listen EPERM: operation not permitted 0.0.0.0:3000
[2021-06-09 10:59:19.222] [info] Error stack : Error: listen EPERM: operation not permitted 0.0.0.0:3000
我正在尝试使用以下代码启动 http 服务器:
module.exports = {
startServer: async () => {
_port = await UtilityService.getPort();
console.log(_port);
return new Promise((resolve, reject) => {
httpServer.on('error', error => {
console.log('Error while starting server: ', error.message);
onError(error);
reject(error);
});
httpServer.listen(_port, () => {
console.log('HTTP Server listening on http://localhost:' + _port + '/');
resolve();
});
})
},
https://github.com/mattehalen/Scheduled-countdown/blob/master/src/server.js
解决方案
推荐阅读
- amazon-web-services - AWS 上的 postgresql.conf 文件
- javascript - 用帖子下载以隐藏用户名和密码?
- java - 在 mac 中使用命令行创建 Android 项目文件夹
- android - 如何保存我的应用偏好并在重新安装或更改设备后检索它们
- scala - 为什么 Akka-Http 路由在这里出错?
- excel - 如果范围之外的单元格=已解决,则将单元格范围复制并粘贴到另一张工作表中,然后删除该行
- java - 如何在 Java MIDI 程序中更改乐器
- amazon-web-services - Travis docker 构建到 AWS ec2 docker
- c# - 在 EF Core 中使用关系删除的最佳实践
- c - 为什么当分配看起来合适时指针分配显示左值错误?