ng build --localize выдает ошибку. Невозможно прочитать свойство startTag со значением null. - PullRequest
0 голосов
/ 17 июня 2020

Я переместил свое приложение angular 6 в angular 9 с включенным движком Ivy. Я использую i18n. согласно angular 9 Я добавил необходимую запись в pollyfills.ts.

ng serve --configuration = EN / FR работает нормально для меня, но когда я делаю ng build --localize это дает мне следующее:

Warning: Entry point '@auth0/angular-jwt' contains deep imports into 'C:/<project path>/node_modules/rxjs/internal/Observable'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Warning: Entry point 'ng5-slider' contains deep imports into 'C:/<project path>/node_modules/ng5-slider/node_modules/rxjs/Subject',
'C:/<project path>/node_modules/ng5-slider/node_modules/rxjs/Subscription', 
'C:/<project path>/node_modules/ng5-slider/node_modules/rxjs/operators'.
 This is probably not a problem, but may cause the compilation of entry points to be out of order.

chunk {} runtime.3e4f8fadf22cf17b6508.js (runtime) 1.45 kB [entry] [rendered]
chunk {1} main.205109a28d6de6927449.js (main) 3.09 MB [initial] [rendered]
chunk {2} polyfills.d9d2ec2594245f0f4b3e.js (polyfills) 108 kB [initial] [rendered]
chunk {3} polyfills-es5.aef9a1edebcfd483b70d.js (polyfills-es5) 191 kB [initial] [rendered]
chunk {4} styles.39251791c5ef9402cab8.css (styles) 105 kB [initial] [rendered]
chunk {scripts} scripts.0076b3fd079bc7a045c7.js (scripts) 2 kB [entry] [rendered]
Date: 2020-06-17T08:27:14.051Z - Hash: dedc9a26d9aa01cf45d0 - Time: 145272ms


Localized bundle generation complete.
Cannot read property 'startTag' of null

Я прошел через несколько решений github, которые предлагали проверить файл index. html, но в моем случае это все нормально. Пожалуйста, найдите ниже индекс. html содержимое файла:

<!doctype html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Project Name</title>
  <base href="/">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Montserrat:300,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
  <link rel="stylesheet" href="assets/bootstrap.min.css">
</head>

<body>
  <app-root></app-root>
</body>

</html>

Ниже мой пакет. json

{
  "name": "ProjectName",
  "version": "1.0.0",
  "scripts": {
    "postinstall": "ngcc",
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng test --watch=false --browsers=ChromeHeadless --code-coverage",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "sonar": "sonar-scanner",
    "build-locale:EN": "ng build --prod --i18n-locale EN --i18n-format xlf --i18n-file src/translate/messages.en.xlf --output-path=dist --base-href /projectName/",
    "build-locale:FR": "ng build --prod --i18n-locale FR --i18n-format xlf --i18n-file src/translate/messages.fr.xlf --output-path=dist/FR --base-href /projectName/FR/",
    "prod": "npm run build-locale:EN && npm run build-locale:FR"
  },
  "private": true,
  "dependencies": {
    "@angular/animation": "4.0.0-beta.8",
    "@angular/animations": "9.1.9",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "9.1.9",
    "@angular/compiler": "9.1.9",
    "@angular/core": "9.1.9",
    "@angular/flex-layout": "^9.0.0-beta.31",
    "@angular/forms": "9.1.9",
    "@angular/localize": "~9.1.9",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "9.1.9",
    "@angular/platform-browser-dynamic": "9.1.9",
    "@angular/router": "9.1.9",
    "@auth0/angular-jwt": "2.1.0",
    "@ng-bootstrap/ng-bootstrap": "4.0.3",
    "angular-bootstrap-md": "^9.3.1",
    "bn-ng-idle": "^1.0.1",
    "bootstrap": "4.0.0",
    "classlist.js": "^1.1.20150312",
    "core-js": "2.5.4",
    "d3": "5.9.1",
    "d3-force": "2.0.0",
    "font-awesome": "4.7.0",
    "hammerjs": "2.0.8",
    "ng-pick-datetime": "^7.0.0",
    "ng5-slider": "^1.2.4",
    "ngx-logger": "3.3.12",
    "ngx-spinner": "^9.0.2",
    "rxjs": "6.5.5",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "webpack": "4.24.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.7",
    "@angular/cli": "9.1.7",
    "@angular/compiler-cli": "9.1.9",
    "@angular/language-service": "9.1.9",
    "@fortawesome/fontawesome-free": "5.7.2",
    "@types/jasmine": "2.8.8",
    "@types/jasminewd2": "2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "2.99.1",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "^4.0.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "2.0.1",
    "karma-jasmine": "1.1.2",
    "karma-jasmine-html-reporter": "0.2.2",
    "karma-junit-reporter": "^1.2.0",
    "karma-typescript": "4.1.1",
    "karma-typescript-angular2-transform": "^4.1.1",
    "node-sass": "^4.13.0",
    "protractor": "5.4.0",
    "puppeteer": "^1.20.0",
    "sonar-scanner": "^3.1.0",
    "ts-node": "7.0.0",
    "tslint": "5.11.0",
    "typescript": "3.8.3"
  }
}

Я много искал это, но ничего не получил. Пожалуйста, помогите мне в этом.

...