简体   繁体   English

吞噬了TypeDoc错误

[英]Gulp with TypeDoc errors out

Good time of the day every body, 每个人身体的好时光,

I have created a gulp task that should create tsdocs, here is what it looks like. 我创建了一个应该创建tsdocs的gulp任务,这就是它的样子。

'use strict';

var gulp = require('gulp'),
    helpers = require('../helpers/gulp-helpers')(),
    plugins = require('gulp-load-plugins')(),
    env = require('./gulp.env');

function typedoc() {


    return gulp.src([
        'src/scripts/**/*!(.spec).ts',
        '!src/scripts/**/*.spec.ts',
        ...env.settings.typings
    ]).pipe(plugins.typedoc({
        module: 'commonjs',
        target: 'es5',
        experimentalDecorators: true,
        ignoreCompilerErrors: false,
        version: true,
        out: 'docs'
    })).on("error", (error) => {
        if (error.plugin && error.message) {
            // it is a gulp plugin error
            helpers.log("Error in plugin: " + error.plugin);
            helpers.log(error.message);
        }
        else {
            // some other error
            helpers.log(error);
        }
        exitCode++;
    }) // make exit code non-zero
}

// Workaround: directly calling process.exit() has corner cases where
// the console.log statements are not flushed (namely if stdout is piped
// instead of goes to a terminal).
let exitCode = 0;
process.on("exit", function() {
    if (exitCode != 0) process.exit(exitCode);
});


gulp.task('ts:docs', typedoc);

When I run it, it fails, with this error list: 当我运行它时,它会失败,并显示以下错误列表:

TypeDoc 0.3.12
Using TypeScript 1.6.2 from /Users//private/cms/node_modules/typedoc/node_modules/typescript/lib

[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(84)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(179)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(180)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(181)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(182)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(183)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(184)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(226)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(227)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(228)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(229)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(230)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(471)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(472)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(473)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(474)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(475)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(476)
 Type expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1836)
 '=' expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1837)
 '=' expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1838)
 '=' expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1838)
 '=' expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1848)
 '=' expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1849)
 '=' expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1850)
 '=' expected.
[11:04:35] /Users//private/cms/typings/main/ambient/node/index.d.ts(1850)
 '=' expected.
[11:04:35] Error in plugin: gulp-typedoc
[11:04:35] Failed to generate load TypeDoc project.
[11:04:35] 'ts:docs' errored after 889 ms
[11:04:35] Error in plugin 'gulp-typedoc'
Message:
    Failed to generate load TypeDoc project.

Typedoc is not updated the typescript 's (dependency module) npm version. Typedoc不更新typescript的(依赖模块) npm版本。 so you just open the typedoc folder which is available in the node_modules folder in your project and edit the package.json file as follows. 所以你只需打开项目中typedoc文件夹中的node_modules文件夹,然后编辑package.json文件,如下所示。

"typescript": "1.6.2" to "typescript": "1.8.10" "typescript": "1.6.2""typescript": "1.8.10"

then run the npm i command against typedoc project. 然后对typedoc项目运行npm i命令。

after that you can run your docs generation script. 之后,您可以运行docs生成脚本。 It will work fine. 它会工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM