在MacOS Sonoma最近的更新之后,ng serve停止工作.我可以运行ng version,它会显示版本,但当我在我的项目中try ng serve时,它什么都不起作用.终端中的光标一直在闪烁,就像它试图处理命令一样.

按照堆栈溢出thisQ+A的要求,我在全局卸载并重新安装了Angular CLI.还是不走运.我也试过使用npm start,同样也不起作用.

以下是我的项目的angular.json文件,如果它有助于澄清任何事情的话.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular.io-example": {
      "projectType": "application",
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": ["zone.js"],
            "tsConfig": "tsconfig.app.json",
            "assets": ["src/favicon.ico", "src/assets"],
            "styles": ["src/styles.css"],
            "scripts": []
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "500kb",
                  "maximumError": "1mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "browserTarget": "angular.io-example:build:production"
            },
            "development": {
              "browserTarget": "angular.io-example:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular.io-example:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "polyfills": ["zone.js", "zone.js/testing"],
            "tsConfig": "tsconfig.spec.json",
            "assets": ["src/favicon.ico", "src/assets"],
            "styles": ["src/styles.css"],
            "scripts": []
          }
        },
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "angular.io-example:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "angular.io-example:serve:production"
            }
          }
        }
      }
    }
  },
  "cli": {
    "analytics": false
  }
}

推荐答案

正如 comments 中所说,删除所有缓存是有效的:

rm -rf node_modules .angular

重新安装依赖项,仅此而已.

Angular相关问答推荐

Angular - Bootstrap 5 Carbon不工作

Angular 升级到v16和Ant设计错误:';nzComponentParams';类型';ModalOptions';中不存在

未在ng bootstrap 模式中设置表单输入

在Angular 多选下拉菜单中实现CDK拖放排序的问题

如果过滤器在rxjs流中触发,则返回空数组

Angular 17不接受带点(.)的路径在开发环境中,它直接抛出一个404错误

如何将角17中的嵌套组件与独立组件一起使用?

Angular 17水化-POST请求同时触发客户端/服务器端,而GET请求仅触发服务器端?

Angular SPA 和 .Net 6 API 之间未连接 Application Insights Map

在组件级别加载 JS 脚本(不在启动时)

Angular ngFor 索引从 1 开始 循环

Angular2 路由 VS ui-router-ng2 VS ngrx 路由

将查询参数附加到 URL

为什么 Angular2 routerLinkActive 将活动类设置为多个链接?

angular 2模板使用console.log

如何设置背景 colored颜色 IONIC 4

如何手动延迟加载模块?

如何在 Angular cli 项目中包含来自 node_modules 的assets

为什么 *ngIf 不适用于 ng-template?

无法绑定到 target,因为它不是div的已知属性