gpt4 book ai didi

typescript - Gulp with TypeDoc 错误

转载 作者:搜寻专家 更新时间:2023-10-30 20:43:00 25 4
gpt4 key购买 nike

每个人一天中的美好时光,

我已经创建了一个应该创建 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);

当我运行它时,它失败了,错误列表如下:

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 未更新 typescript 的(依赖模块)npm 版本。因此,您只需打开项目中 node_modules 文件夹中的 typedoc 文件夹,然后按如下方式编辑 package.json 文件。

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

然后针对 typedoc 项目运行 npm i 命令。

之后您可以运行您的文档生成脚本。它会正常工作。

关于typescript - Gulp with TypeDoc 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36327688/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com