我正在学习 https://angular.io/cli 的教程,但在我的命令提示符下使用命令 ng serve 后,我无法连接到 http://localhost:4200

The page returned the following error: This site can’t provide a secure connection, ERR_SSL_PROTOCOL_ERROR

The project is compiled successfully
  • 我曾尝试允许 nodejs.exe 和 chrome.exe 进入防火墙
  • 我从(设置 -> 高级设置 -> 打开代理设置 -> LAN 设置)禁用了代理服务器
  • 我试过 telnet cmd>telnet localhost 4200 (成功)
  • 我尝试从 Internet Explorer 连接,它工作正常,但网页中没有内容。

  • 以下是按照教程在 windows 命令提示符下执行的:
    C:\Users\Ufinity\Desktop\test-angular>ng serve
    
    10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
    i 「wds」: webpack output is served from /
    i 「wds」: 404s will fallback to //index.html
    
    chunk {main} main.js, main.js.map (main) 49.4 kB [initial] [rendered]
    chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
    chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
    chunk {styles} styles.js, styles.js.map (styles) 9.71 kB [initial] [rendered]
    chunk {vendor} vendor.js, vendor.js.map (vendor) 4.08 MB [initial] [rendered]
    Date: 2019-09-05T09:55:54.613Z - Hash: 2c73ac9786af94e810bc - Time: 10587ms
    ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
    i 「wdm」: Compiled successfully.
    

    我应该能够连接到 http://localhost:4200 并且页面应该显示欢迎使用 test-angular 页面。

    最佳答案

  • 解决方案 1:使用隐身谷歌浏览器转到 http://localhost:4200
  • 解决方案 2:确保您没有连接到任何 VPN:
  • 转到开发者工具 Chrome 3 点 > 更多工具 > 开发者工具
  • 右键单击​​刷新按钮 > 选择 > 清空缓存和硬重新加载
  • 然后输入 http://localhost:4200

  • Go to developer tools

    Empty cache and hard reload

    Enter http://localhost:4200

    关于node.js - 如何连接到 angular、nodejs http ://localhost:4200 in google chrome,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57803161/

    10-12 17:29
    查看更多