TT Bigdata TT Bigdata
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件专题

    • 安装指导
    • 开启 Kerberos
    • 魔改分享
  • 版本专题

    • 更新说明
    • BUG临时处理
  • 实验室

    • VIEW插件
    • JIRA速查
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • APT仓库增量更新
    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Ambari-Metrics
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

    • 各组件代码
    • 通用代码模板
  • 国产化&其他系统

    • Kylin V10系列
    • Rocky系列
    • Ubuntu系列
  • Grafana监控方案

    • Ambari-Metrics插件
    • Infinity插件
  • 支持&共建

    • 蓝图愿景
    • 合作共建
登陆
GitHub (opens new window)

JaneTTR

数据酿造智慧,每一滴都是沉淀!
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件专题

    • 安装指导
    • 开启 Kerberos
    • 魔改分享
  • 版本专题

    • 更新说明
    • BUG临时处理
  • 实验室

    • VIEW插件
    • JIRA速查
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • APT仓库增量更新
    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Ambari-Metrics
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

    • 各组件代码
    • 通用代码模板
  • 国产化&其他系统

    • Kylin V10系列
    • Rocky系列
    • Ubuntu系列
  • Grafana监控方案

    • Ambari-Metrics插件
    • Infinity插件
  • 支持&共建

    • 蓝图愿景
    • 合作共建
登陆
GitHub (opens new window)
  • Hadoop

  • Spark

  • Trino

  • Hudi

  • Paimon

  • Livy

  • Flink

    • .git can't be found during `prepare`
    • Angular CLI requires Node >=14.15
    • npm run ci-check 报错退出码 3
    • TypeScript 类型声明错误
      • 一、构建背景与问题概述
        • 构建环境说明
      • 二、报错详情与日志分析
        • 1.报错日志
        • 2.frontend-maven-plugin 执行过程
        • 3.TypeScript 报错区段
        • 4.npm 退出与报错总结
      • 三、深入分析:为什么会出错?
        • frontend-maven-plugin 机制简述
      • 四、解决方案:锁定类型版本
        • 1.修改 package.json
        • 2.清理与重新安装依赖
        • 3.重新构建验证
      • 五、验证成功
  • Atlas

  • Superset

  • Jsvc

  • Zookeeper

  • Hive

  • Sqoop

  • Cloudbeaver

  • Bigtop-select

  • 报错解决-Bigtop
  • Flink
JaneTTR
2025-10-01
目录

TypeScript 类型声明错误kylin10

# 一、构建背景与问题概述

在 Bigtop 环境下编译 Flink 1.17.2 RPM 包时,常规命令如下:

mvn package install -Drat.skip=true -DskipTests -Dhadoop.version=3.3.4
1

Flink 的 Web 前端模块 flink-runtime-web 在构建时会通过 frontend-maven-plugin 插件调用 Node/npm 完成前端打包任务。 当执行到此模块时,出现长时间构建后报错退出:

image-20250929110311818

image-20250929110325662

在 CI 环境下,此错误会直接导致整个 RPM 打包链中断,日志最后退出码为 1。

# 构建环境说明

环境项 版本/说明
操作系统 Kylin V10 SP3
Flink 版本 1.17.2
Bigtop 版本 3.2.0
Node.js v16.13.2
npm 8.1.2
TypeScript 4.8.4
frontend-maven-plugin 1.11.0

💡 说明: Bigtop 构建 Flink 时,会自动在临时目录下下载 Node 与 npm,可在日志中找到对应路径: /opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard/node/node

# 二、报错详情与日志分析

# 1.报错日志

[INFO] Flink : Tools : CI : Java .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  50:06 min
[INFO] Finished at: 2025-09-29T02:49:15Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.0:npm (npm run ci-check) on project flink-runtime-web: Failed to run task: 'npm run ci-check --
verbose' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :flink-runtime-web
error: Bad exit status from /var/tmp/rpm-tmp.JrxedO (%build)


RPM build errors:
    Macro expanded in comment on line 169: %{doc_flink}

    Bad exit status from /var/tmp/rpm-tmp.JrxedO (%build)

> Task :flink-rpm FAILED

FAILURE: Build failed with an exception.

* Where:
Script '/opt/modules/bigtop/packages.gradle' line: 667

* What went wrong:
Execution failed for task ':flink-rpm'.
> Process 'command 'rpmbuild'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 50m 29s
10 actionable tasks: 10 exec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

# 2.frontend-maven-plugin 执行过程

frontend-maven-plugin 会在 Maven 阶段自动执行 Node/npm:

[INFO] --- frontend-maven-plugin:1.11.0:npm (npm run ci-check) @ flink-runtime-web ---
[DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.11.0:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.11.0, parent: s
un.misc.Launcher$AppClassLoader@7852e922]
[DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.11.0:npm' with basic configurator -->
[DEBUG]   (f) arguments = run ci-check --verbose
[DEBUG]   (f) npmInheritsProxyConfigFromMaven = true
[DEBUG]   (f) project = MavenProject: org.apache.flink:flink-runtime-web:1.17.2 @ /opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/pom.xml
[DEBUG]   (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@2a0963be
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@1988cca8
[DEBUG]   (f) skipTests = true
[DEBUG]   (f) testFailureIgnore = false
[DEBUG]   (f) workingDirectory = /opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard
[DEBUG]   (f) execution = com.github.eirslett:frontend-maven-plugin:1.11.0:npm {execution: npm run ci-check}
[DEBUG] -- end configuration --
[INFO] Running 'npm run ci-check --verbose' in /opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard
[DEBUG] Executing command line [/opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard/node/node, /opt/modules/bigtop/build/flink/rpm/BUILD/f
link-1.17.2/flink-runtime-web/web-dashboard/node/node_modules/npm/bin/npm-cli.js, run, ci-check, --verbose]
[INFO] npm verb cli [
[INFO] npm verb cli   '/opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard/node/node',
[INFO] npm verb cli   '/opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard/node/node_modules/npm/bin/npm-cli.js',
[INFO] npm verb cli   'run',
[INFO] npm verb cli   'ci-check',
[INFO] npm verb cli   '--verbose'
[INFO] npm verb cli ]
[INFO] npm info using npm@8.1.2
[INFO] npm info using node@v16.13.2
[INFO] npm timing npm:load:whichnode Completed in 0ms
[INFO] npm timing config:load:defaults Completed in 1ms

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

此时 npm 开始执行 Angular CLI 打包(ng build),随后出现 TypeScript 编译报错:

# 3.TypeScript 报错区段

[INFO] npm timing config:load:builtin Completed in 0ms
[INFO] npm timing config:load:cli Completed in 1ms
[INFO] npm timing config:load:env Completed in 0ms
[INFO] npm timing config:load:file:/opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard/.npmrc Completed in 0ms
[INFO] npm timing config:load:project Completed in 1ms
[INFO] npm timing config:load:file:/root/.npmrc Completed in 0ms
[INFO] npm timing config:load:user Completed in 0ms
[INFO] npm timing config:load:file:/opt/modules/bigtop/build/flink/rpm/BUILD/flink-1.17.2/flink-runtime-web/web-dashboard/etc/npmrc Completed in 0ms
[INFO] npm timing config:load:global Completed in 0ms
[INFO] npm timing config:load:validate Completed in 0ms
[INFO] npm timing config:load:credentials Completed in 1ms
[INFO] npm timing config:load:setEnvs Completed in 0ms
[INFO] npm timing config:load Completed in 4ms
[INFO] npm timing npm:load:configload Completed in 4ms
[INFO] npm timing npm:load:setTitle Completed in 1ms
[INFO] npm timing npm:load:setupLog Completed in 0ms
[INFO] npm timing config:load:flatten Completed in 1ms
[INFO] npm timing npm:load:cleanupLog Completed in 1ms
[INFO] npm timing npm:load:configScope Completed in 0ms
[INFO] npm timing npm:load:projectScope Completed in 1ms
[INFO] npm timing npm:load Completed in 10ms
[INFO]
[INFO] > flink-dashboard@2.0.0 build
[INFO] > ng build --configuration production --base-href ./
[INFO]
[INFO] - Generating browser application bundles (phase: setup)...
[INFO] ??? Browser application bundle generation complete.
[INFO] ??? Browser application bundle generation complete.
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:91:5 - error TS1139: Type parameter declaration expected.
[INFO]
[INFO] 91     const EventNames extends keyof any = keyof EventMap,
[INFO]        ~~~~~
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:91:22 - error TS1005: ',' expected.
[INFO]
[INFO] 91     const EventNames extends keyof any = keyof EventMap,
[INFO]                         ~~~~~~~
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:91:36 - error TS1005: ',' expected.
[INFO]
[INFO] 91     const EventNames extends keyof any = keyof EventMap,
[INFO]                                       ~~~
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:91:48 - error TS1005: ',' expected.
[INFO]
[INFO] 91     const EventNames extends keyof any = keyof EventMap,
[INFO]                                                   ~~~~~~~~
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:92:1 - error TS1109: Expression expected.
[INFO]
[INFO] 92 >(
[INFO]    ~
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:93:5 - error TS1109: Expression expected.
[INFO]
[INFO] 93     ...types: EventNames[]
[INFO]        ~~~
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:93:26 - error TS1011: An element access expression should take an argument.
[INFO]
[INFO] 93     ...types: EventNames[]
[INFO]
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:94:1 - error TS1128: Declaration or statement expected.
[INFO]
[INFO] 94 ): Dispatch<This, EventMap>;
[INFO]    ~
[INFO]
[INFO]
[INFO] Error: node_modules/@types/d3-dispatch/index.d.ts:94:2 - error TS1128: Declaration or statement expected.
[INFO]
[INFO] 94 ): Dispatch<This, EventMap>;
[INFO]     ~
[INFO]
[INFO]
[INFO]
[INFO] npm timing command:run-script Completed in 50218ms
[INFO] npm notice
[INFO] npm notice New major version of npm available! 8.1.2 -> 11.6.1
[INFO] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v11.6.1>
[INFO] npm notice Run `npm install -g npm@11.6.1` to update!
[INFO] npm notice
[INFO] npm verb exit 1
[INFO] npm timing npm Completed in 50309ms
[INFO] npm verb code 1
[INFO] npm timing command:run-script Completed in 51064ms
[INFO] npm notice
[INFO] npm notice New major version of npm available! 8.1.2 -> 11.6.1
[INFO] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v11.6.1>
[INFO] npm notice Run `npm install -g npm@11.6.1` to update!
[INFO] npm notice
[INFO] npm verb exit 1
[INFO] npm timing npm Completed in 51154ms
[INFO] npm verb code 1
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Flink : 1.17.2:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

# 4.npm 退出与报错总结

[INFO] npm notice New major version of npm available! 8.1.2 -> 11.6.1
[INFO] npm verb exit 1
[INFO] npm timing npm Completed in 51154ms
1
2
3

TS1139 表示类型参数声明语法错误。 根据错误文件路径 @types/d3-dispatch/index.d.ts,可以推测是 类型声明文件语法 超出当前 TypeScript 版本的能力范围。

# 三、深入分析:为什么会出错?

在 Flink 的 Web 模块中,TypeScript 版本被固定为 4.8.4:

"typescript": "~4.8.4"
1

然而,@types/d3-dispatch 升级到了 3.1.x 版本。 该版本的声明文件使用了 TypeScript 5.x 新增的泛型默认值语法:

const EventNames
extends
keyof
any = keyof
EventMap,
1
2
3
4
5

而 4.x 系列的 TypeScript 并不支持这种语法,因此报错。

技术延伸:TS 与 d3 类型文件关系

d3 系列库(d3-selection / d3-zoom / d3-dispatch)都由 DefinitelyTyped 提供类型定义,版本号通常跟随 d3 主版本,但类型文件会单独维护。 这类 @types 包没有固定与 TypeScript 主版本的兼容关系。

# frontend-maven-plugin 机制简述

frontend-maven-plugin 主要职责是:

  1. 自动下载 Node 环境;
  2. 在指定工作目录下执行 npm/yarn 命令;
  3. 捕获退出码并传递回 Maven。

也就是说:一旦 npm 构建失败,整个 mvn install 流程就会被中断。

在本例中,由于前端打包失败,flink-rpm 模块收到非零返回码,进而触发整个 RPM 构建失败。

# 四、解决方案:锁定类型版本

根本思路:

让 TypeScript 与类型声明文件回到同一时代。

# 1.修改 package.json

打开:

flink-runtime-web/web-dashboard/package.json
1

添加如下配置:

image-20251010095958251

@@ -79,7 +79,15 @@
     "stylelint-order": "^5.0.0",
     "stylelint-prettier": "^2.0.0",
     "ts-node": "^10.4.0",
-    "typescript": "~4.8.4"
+    "typescript": "~4.8.4",
+    "@types/d3-dispatch": "3.0.6",
+    "@types/d3-selection": "3.0.6",
+    "@types/d3-zoom": "3.0.8"
+  },
+  "overrides": {
+    "@types/d3-dispatch": "3.0.6",
+    "@types/d3-selection": "3.0.6",
+    "@types/d3-zoom": "3.0.8"
   },
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

其中:

  • "overrides" 是 npm 8+ 的特性,用于覆盖依赖树中被其他包引用的版本;
  • "3.0.x" 系列仍兼容 TypeScript 4.x。

# 2.清理与重新安装依赖

cd flink-runtime-web/web-dashboard
rm -rf node_modules package-lock.json
npm install --legacy-peer-deps
1
2
3

💡 加上 --legacy-peer-deps 可以避免 npm 对 peer 依赖进行严格检查(Angular 项目常用)。

# 3.重新构建验证

npm run build
1

或:

mvn install -Drat.skip=true -DskipTests -Dhadoop.version=3.3.4 -rf :flink-runtime-web
1

# 五、验证成功

构建顺利通过:

[INFO] > flink-dashboard@2.0.0 build
[INFO] > ng build --configuration production --base-href ./
[INFO]
[INFO] Browser application bundle generation complete.
[INFO] BUILD SUCCESS
1
2
3
4
5

Flink RPM 包也最终生成成功:

image-20251009153908369

image-20251009153820649

#Flink#TypeScript#d3-dispatch#frontend-maven-plugin#Node.js#Angular
npm run ci-check 报错退出码 3
Atlas 集成 JanusGraph 启动时报 Solr6Index 实例化失败解决

← npm run ci-check 报错退出码 3 Atlas 集成 JanusGraph 启动时报 Solr6Index 实例化失败解决→

最近更新
01
Ambari开启Kerberos认证加密类型错误 Kylin V10
11-05
02
KERBEROS SERVICE CHECK 报错
11-04
03
Test Kerberos Client报错:Failed to kinit
11-04
更多文章>
Theme by Vdoing | Copyright © 2017-2025 JaneTTR | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式