Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.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
TypeDoc找不到Angular2模块_Angular_Typescript_Typedoc - Fatal编程技术网

TypeDoc找不到Angular2模块

TypeDoc找不到Angular2模块,angular,typescript,typedoc,Angular,Typescript,Typedoc,我正在尝试使用TypeDoc生成文档文件。当我使用以下命令运行TypeDoc时: /node_modules/.bin/typedoc --module system --target ES5 --exclude *.spec.ts* --experimentalDecorators --out typedoc app/ --ignoreCompilerErrors 它作为输出给出: Using TypeScript 1.6.2 from /development/node_modules/t

我正在尝试使用TypeDoc生成文档文件。当我使用以下命令运行TypeDoc时:

/node_modules/.bin/typedoc --module system --target ES5 --exclude *.spec.ts* --experimentalDecorators --out typedoc app/ --ignoreCompilerErrors
它作为输出给出:

Using TypeScript 1.6.2 from /development/node_modules/typedoc/node_modules/typescript/lib
Error: /development/app/angular2/app.ts(1)
 Cannot find module 'angular2/core'.
Error: /development/app/angular2/app.ts(2)
 Cannot find module 'angular2/upgrade'.
Error: /development/app/angular2/app.ts(3)
 Cannot find module 'angular2/platform/browser'.
Error: /development/app/angular2/app.ts(5)
tsconfig.json

{
  "compilerOptions": {
    "target": "ES5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules"
  ]
}

这里是否缺少某种类型的参数来包含libs或
.d.ts.
文件?

我将typedoc与angular2应用程序一起使用。虽然我通过gulptypedoc运行它,但传递的参数应该是相同的。以下吞咽任务为我完成了这项工作:

gulp.task("doc", function() {
    return gulp
        .src(["./myproject/**/*.ts"])
        .pipe(typedoc({ 
            // TypeScript options (see typescript docs) 
            module: "commonjs", 
            target: "es5",
            includeDeclarations: false,
            experimentalDecorators: true,

            // Output options (see typedoc docs) 
            out: "./docs", 

            // TypeDoc options (see typedoc docs) 
            name: "MyProject", 
            ignoreCompilerErrors: false,
            excludeExternals:true,
            version: true,
        }));
});

希望这能有所帮助。

我尝试了commonjs模块,它成功了

typedoc --experimentalDecorators --target 'es5' --module 'commonjs' --out doc-destination/ src/

在tsconfig.json中添加类型定义文件的配置,然后重试

"typeRoots": [
  "node_modules/@types" ]

可能与tsconfig.json有关的一些问题。你能发布吗?我已经在问题中添加了我的tsconfig,json