Angular - ng serve command is falling ERR_NO_ICU

1.1k Views Asked by At

I'm developing a website with Spring Boot and Angular, and I'm facing some difficulties while trying to start Angular's live development server :

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)

All nodes modules were installed (npm install), below is my package.json file :

{
  "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"
  }
}

And this is my 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",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/popper.js/dist/umd/popper.min.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ],
            "styles": [
              "node_modules/font-awesome/css/font-awesome.css",
              "node_modules/bootstrap/dist/css/bootstrap.css",
              "node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
              "src/seed.css",
              "src/styles.less",
            ],
            "assets": [
              "src/assets",
              "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"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.json"
            ],
            "exclude": []
          }
        }
      }
    }
  },
  "defaultProject": "angular2-seed",
  "cli": {
    "defaultCollection": "@ngrx/schematics"
  }
}

Is anyone familiar with this issue? Are there any conflicts with the versions? I couldn't find any solution for that so far.

1

There are 1 best solutions below

0
On

Try to reinstall Angular CLI with following command

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