我目前正在将Angular 7应用程序升级到Angular 8,并且遇到了一些问题-之前我已经相对顺利地从Angular 5和6进行了升级,因此我对使用{ {3}}。
我已经按照所有步骤操作,并将所有Angular依赖项成功升级到8.1.x
。我现在将{ static: false }
与ViewChild一起使用,并且我对Angular Material的导入使用更深的导入进行了更新。
当我尝试使用ng build --aot --prod --build-optimizer=false
来构建应用程序时,就会出现问题。有了这个我得到以下错误。
chunk {0} runtime.e9d4a8365190f9ee7214.js (runtime) 2.21 kB [entry] [rendered]
chunk {1} main.82103d8cb2976079a759.js (main) 6.52 MB [initial] [rendered]
chunk {2} pdfjsWorker.4df5ce1f8ece90d58a9f.js (pdfjsWorker) 741 kB [rendered]
chunk {3} polyfills.884b7d233bf412d2ec81.js (polyfills) 63.7 kB [initial] [rendered]
chunk {4} polyfills-es5.fb30af840b34e7fa0bb5.js (polyfills-es5) 69.8 kB [initial] [rendered]
chunk {5} styles.169e0b9ec596a5a72c8f.css (styles) 66.5 kB [initial] [rendered]
Date: 2019-07-26T00:55:16.623Z - Hash: 142d65823e318484d40b - Time: 68210ms
ERROR in ./src/app/app.module.ngfactory.js 318:10580-10593
"export 'DOCUMENT' (imported as 'i129') was not found in '@angular/platform-browser'
ERROR in ./node_modules/ng-intercom/fesm5/ng-intercom.js 501:83-91
"export 'DOCUMENT' was not found in '@angular/platform-browser'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.39.3290 build: `npx ng build --aot --prod --build-optimizer=false && npx tsc -p tsconfig.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.39.3290 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
我真的不确定整个export DOCUMENT
问题是怎么回事。
这就是我运行ng --version
时得到的。
Angular CLI: 8.1.2
Node: 10.15.3
OS: darwin x64
Angular: 8.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.801.2
@angular-devkit/build-angular 0.801.2
@angular-devkit/build-optimizer 0.801.2
@angular-devkit/build-webpack 0.801.2
@angular-devkit/core 8.1.2
@angular-devkit/schematics 8.1.2
@angular/cdk 8.1.1
@angular/http 7.2.15
@angular/material 8.1.1
@angular/material-moment-adapter 8.1.1
@ngtools/webpack 8.1.2
@schematics/angular 8.1.2
@schematics/update 0.801.2
rxjs 6.5.2
typescript 3.4.5
webpack 4.35.2
答案 0 :(得分:1)
看起来ng-intercom依赖项是从platform-browser导入DOCUMENT的,而现在应该从'@ angular / common'导入。
尝试查看是否有支持较新版本Angular的ng-intercom新版本,然后尝试再次运行ng update。
答案 1 :(得分:0)
文档不再位于@angular/platform-browser
中
它位于@angular/common
import { DOCUMENT } from '@angular/common'<----replace;