Angular - ng serve 命令正在下降 ERR_NO_ICU

如何解决Angular - ng serve 命令正在下降 ERR_NO_ICU

我正在使用 Spring Boot 和 Angular 开发一个网站,但在尝试启动 Angular 的实时开发服务器时遇到了一些困难:

ubuntuserver]#> ng serve
internal/encoding.js:429
          throw new errors.TypeError('ERR_NO_ICU','"fatal" option');
          ^

TypeError [ERR_NO_ICU]: "fatal" option is not supported on Node.js compiled without ICU
    at new TextDecoder (internal/encoding.js:429:17)
    at Object.<anonymous> (/service/src/main/resources/static/node_modules/@angular-devkit/schematics/src/rules/template.js:27:17)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/service/src/main/resources/static/node_modules/@angular-devkit/schematics/src/index.js:26:10)

所有节点模块都已安装(npm install),下面是我的 package.json 文件

{
  "name": "angular2-seed","version": "0.3.1","license": "MIT","scripts": {
    "ng": "ng","start": "ng serve --host 0.0.0.0 --port 4202","build": "ng build","buildProd": "ng build --prod","test": "ng test","lint": "ng lint","e2e": "ng e2e"
  },"private": true,"dependencies": {
    "@angular/animations": "^9.1.12","@angular/cdk": "~9.1.2","@angular/common": "^9.1.12","@angular/compiler": "^9.1.12","@angular/core": "^9.1.12","@angular/forms": "^9.1.12","@angular/localize": "^9.1.12","@angular/material": "~9.1.2","@angular/platform-browser": "^9.1.12","@angular/platform-browser-dynamic": "^9.1.12","@angular/router": "^9.1.12","@auth0/angular-jwt": "~4.0.0","@ng-bootstrap/ng-bootstrap": "~6.1.0","@ngrx/effects": "^9.1.2","@ngrx/entity": "^9.2.0","@ngrx/schematics": "^10.0.1","@ngrx/store": "^9.1.2","@ngrx/store-devtools": "^9.1.2","@popperjs/core": "^2.5.4","ag-grid-angular": "^24.1.0","ag-grid-community": "^24.1.0","angular-2-local-storage": "^3.0.2","bootstrap": "~4.4.1","fibers": "^3.1.1","font-awesome": "^4.7.0","html-webpack-plugin": "^4.5.0","jquery": "^3.5.1","ngx-toastr": "^12.1.0","node-sass": "^4.14.1","popper.js": "^1.16.1","reselect": "^4.0.0","rxjs": "^6.6.3","rxjs-compat": "^6.6.3","tslib": "^1.14.1","webpack": "^4.44.2","zone.js": "~0.10.2"
  },"devDependencies": {
    "@angular-devkit/build-angular": "^0.901.12","@angular/cli": "^9.1.12","@angular/compiler-cli": "^9.1.12","@angular/language-service": "^9.1.12","@types/jasmine": "^3.5.14","@types/jasminewd2": "~2.0.3","@types/node": "^12.19.4","codelyzer": "^5.1.2","jasmine-core": "~3.5.0","jasmine-spec-reporter": "~4.2.1","karma": "~4.4.1","karma-chrome-launcher": "~3.1.0","karma-coverage-istanbul-reporter": "~2.1.0","karma-jasmine": "~3.0.1","karma-jasmine-html-reporter": "^1.5.4","mimic": "^2.0.2","protractor": "~5.4.3","ts-node": "~8.3.0","tslint": "^5.20.1","typescript": "~3.8.3"
  }
}

这是我的 angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json","version": 1,"newProjectRoot": "projects","projects": {
    "angular2-seed": {
      "projectType": "application","schematics": {
        "@schematics/angular:component": {
          "style": "less"
        }
      },"root": "","sourceRoot": "src","prefix": "app","architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser","options": {
            "aot": true,"outputPath": "dist","index": "src/index.html","main": "src/main.ts","polyfills": "src/polyfills.ts","tsConfig": "tsconfig.app.json","assets": [
              "src/assets","src/favicon.ico"
            ],"styles": [
              "node_modules/font-awesome/css/font-awesome.css","node_modules/bootstrap/dist/css/bootstrap.css","node_modules/ngx-toastr/toastr.css","src/seed.css","src/styles.less",],"scripts": [
              "node_modules/jquery/dist/jquery.js","node_modules/popper.js/dist/umd/popper.min.js","node_modules/bootstrap/dist/js/bootstrap.js"
            ]
          },"configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts","with": "src/environments/environment.prod.ts"
                }
              ],"optimization": true,"outputHashing": "all","sourceMap": false,"extractCss": true,"namedChunks": false,"extractLicenses": true,"vendorChunk": false,"buildOptimizer": true,"budgets": [
                {
                  "type": "initial","maximumWarning": "10mb","maximumError": "15mb"
                },{
                  "type": "anyComponentStyle","maximumWarning": "6kb","maximumError": "10kb"
                }
              ]
            }
          }
        },"serve": {
          "builder": "@angular-devkit/build-angular:dev-server","options": {
            "browserTarget": "angular2-seed:build"
          },"configurations": {
            "production": {
              "browserTarget": "angular2-seed:build:production"
            }
          }
        },"extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n","options": {
            "browserTarget": "angular2-seed:build"
          }
        },"test": {
          "builder": "@angular-devkit/build-angular:karma","options": {
            "main": "src/test.ts","karmaConfig": "./karma.conf.js","tsConfig": "tsconfig.spec.json","node_modules/bootstrap/dist/js/bootstrap.js"
            ],"node_modules/ng2-toastr/bundles/ng2-toastr.min.css","src/favicon.ico"
            ]
          }
        },"lint": {
          "builder": "@angular-devkit/build-angular:tslint","options": {
            "tsConfig": [
              "tsconfig.app.json","tsconfig.spec.json","e2e/tsconfig.json"
            ],"exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },"angular2-seed-e2e": {
      "root": "e2e","sourceRoot": "e2e","projectType": "application","architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor","options": {
            "protractorConfig": "e2e/protractor.conf.js","devServerTarget": "angular2-seed:serve"
          }
        },"options": {
            "tsConfig": [
              "e2e/tsconfig.json"
            ],"exclude": []
          }
        }
      }
    }
  },"defaultProject": "angular2-seed","cli": {
    "defaultCollection": "@ngrx/schematics"
  }
}

有人熟悉这个问题吗?与版本有冲突吗?到目前为止,我找不到任何解决方案。

解决方法

尝试使用以下命令重新安装 Angular CLI

npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?