1.Cannot find module 'tslib'報錯,npm install tslib --save解決
2.tslib_1.__exportStar(require("@angular/compiler-cli/src/metadata/collector"), exports);TypeError: tslib_1.__exportStar is not a function。發現是tslib版本太低了,之前依賴1.5.0,升級^1.11.1後解決報錯。
3.Property 'includes' does not exist on type 'string[]',報錯, 解決:Add "ES2017"
to your "lib"
array in tsconfig.json
:或者使用indexOf()方法,不用includes。
4.
ERROR in Metadata version mismatch for module /node_modules/angular2-cool-storage/index.d.ts, found version 4, expected 3,
原因: 可能是版本過高導致
解決辦法:隨便修改代碼註釋,觸發重新編譯即可。
5.@ng-bootstrap/ng-bootstrap/modal/modal-ref.d.ts(40,35): error TS1005: ';' expected 類似報錯,一般是版本不匹配造成的。我的問題由6.0版本修改成2.2.2即解決。
6.Cannot determine the module for class XXX, prod 下編譯,npm 版本的問題可能會導致這個報錯。內部組件和外部模塊依賴相同的包,如果版本不同,組件內部和外部的node_modules都會下載該包,pord模式下編譯校驗不通過。
解決思路:組件和模塊依賴版本保持一致,更新node版本10以上。
7.ng6新增@angular-devkit/build-angular,如果不依賴,發現ng build不能編譯。