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不能编译。