angular项目启动时出错--font failed

633 阅读1分钟

错误详情

angular项目构建的时候出错:Error: Inlining of fonts failed. An error has occurred while retrieving fonts.googleapis.com/css2?family… over the internet. connect ETIMEDOUT 2404:6800:4005:809::200a:443

解决方法

到angular.json中按照下面这样的层级去找到build里面的options

{
  "projects": {
      "你项目的名字": {
        "architect": {
          "build": {
            "options": {
              "optimization": {
                "scripts": true,
                "styles": true,
                "fonts": false
              }
            }
          }
        }
      }
    } 
}

然后在options里加上这段内容,再去启动看看效果应该就行了.

"optimization": {
  "scripts": true,
  "styles": true,
  "fonts": false
}