angular - 发生未处理的异常 : Dev-server address info is not defined

标签 angular ssl command-line-interface host serve

当我尝试使用带有自定义主机名的 ssl 使用 ng serve 时,我将收到未处理的异常:未定义开发服务器地址信息。错误。
我想知道是否有人有解决这个问题的方法。
ng 服务 --host myapp.local --port 4200 --ssl --ssl-key 'certs/myapp.local.key' --ssl-cert 'certs/myapp.local.crt'
myapp.local 在主机文件中设置为 127.0.0.1。我还添加了
“选项”: {
“disableHostCheck”:是的,
“allowedHosts”:[“myapp.local”],
"sslCert": "certs/myapp.local.crt",
"sslKey": "certs/myapp.local.key",
“browserTarget”:“最新的 Angular :构建”,
“主机”:“myapp.local”,
“端口”:4200,
“ssl”:是的
}
任何帮助将不胜感激!

最佳答案

就我而言,问题在于未正确生成的自签名证书。
此命令已正确生成证书:openssl req -newkey rsa:2048 -keyout localhost.key -x509 -days 3650 -out localhost.crt -nodes -sha256

关于angular - 发生未处理的异常 : Dev-server address info is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71403013/

相关文章:

angular - 如何避免在每一行上使用await

html - 剪辑路径在 Safari 上无法正常工作

java - 如何为嵌入式证书指定 JVM SSL 参数?

linux - 匹配模式的 mv 文件夹

javascript - 访问 Sourcetree 中的旧分支时出错

angular - ngx-toastr ToastrService.show() 类型参数 Angular 2 +

ssl - Letsencrypt SSL证书错误

ssl - 警告 : Module not found [ssl]

google-cloud-platform - 如何使用 CLI 命令更改 GCP 中的项目

node.js - 在 Azure 上运行 NodeJS 命令