我得到了一个错误,如下在我的角5应用程序。我正在使用Angular CLI并从VSCode中运行。
错误:非法状态:无法在node_modules/@angular/cdk/observers/typings/index.d.ts.中加载指令CdkObserveContent的摘要
只有当我执行ng build --prod时,错误才会被抛出。命令ng serve和ng build很好。

知道吗,可能是什么原因?
发布于 2018-04-10 06:15:46
好吧,让我回答我自己的问题。这真的很奇怪。我已经将tsconfig.json文件中的tsconfig.json值更改为.,从而解决了这里的问题。这个帖子确实帮助我做到了这一点。我不知道ng build --prod和这个rootDir有什么关系。现在所有的命令都正常工作。
前tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"outDir": "bin",
"rootDir": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}tsconfig.json 新
{
"compileOnSave": false,
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"outDir": "bin",
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}

希望能帮上忙。
https://stackoverflow.com/questions/49746445
复制相似问题