Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular ngc在错误的目录中查找_Angular_Angular2 Aot_Angular Compiler Cli - Fatal编程技术网

Angular ngc在错误的目录中查找

Angular ngc在错误的目录中查找,angular,angular2-aot,angular-compiler-cli,Angular,Angular2 Aot,Angular Compiler Cli,我已全局安装了@angular/compiler cli,并将以下tsconfig aot.json添加到我的客户端目录: { "compilerOptions": { "target": "es5", "module": "es2015", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators"

我已全局安装了
@angular/compiler cli
,并将以下tsconfig aot.json添加到我的客户端目录:

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "types": []
  },
    "exclude": [
        "../node_modules"
    ],

  "angularCompilerOptions": {
   "genDir": "aot",
   "skipMetadataEmit" : true
 }
}
如文件中建议的那样。然后在我的客户机目录中运行
ngc-p tsconfig aot.json
,但出现以下错误:

错误:编译失败。未找到资源文件:C:/Users/George/Source/Repos/docs/client/components/home/client/components/home/home.html


因为资源不在那里。。my home.html位于
C:/Users/George/Source/Repos/docs/client/components/home/home.html
,tsc运行良好,我一直在使用JIT编译,并且有一个可用的应用程序,那么,AOT在错误的位置查找我的文件是什么呢?

在组件ts文件中,您应该将“templateUrl”更改为相对路径,并添加“moduleId:module.id”

例如,来自:

@Component ({
    selector: "login",
    templateUrl:'app/components/login/login.component.html'
})
致:


这就解决了我的问题,希望能有所帮助……

我也有同样的问题。有新闻人物吗?
@Component ({
    selector: "login",
    moduleId: module.id,
    templateUrl:'login.component.html'
})