当前位置: 首页 > news >正文

jenkins打包报错 - 实践

jenkins打包报错 - 实践

报错信息

Done in 14s using pnpm v10.16.1
> jg-inms-application-app@develop develop
> vite build --mode develop
[36mvite v5.4.21 [32mbuilding for develop...[36m[39m
<script src="./config/basic.js"> in "/index.html" can't be bundled without type="module" attributetransforming...[unplugin-vue-components] component "IndexRange"(/data/.jenkins/workspace/jg-inms-application-web/src/components/MyDateTime/indexRange.vue) has naming conflicts with other components, ignored.[unplugin-vue-components] component "Index copy"(/data/.jenkins/workspace/jg-inms-application-web/src/components/MyTerminal/index copy.vue) has naming conflicts with other components, ignored.[32m[39m 634 modules transformed.[31mx[39m Build failed in 5.34s[31merror during build:[31m[vite:load-fallback] Could not load /data/.jenkins/workspace/jg-inms-application-web/src/components/MyUpload/index.vue (imported by src/plugins/components.js): ENOENT: no such file or directory, open '/data/.jenkins/workspace/jg-inms-application-web/src/components/MyUpload/index.vue'[31mat async open (node:internal/fs/promises:639:25)at async Object.readFile (node:internal/fs/promises:1246:14)at async Object.load (file:///data/.jenkins/workspace/jg-inms-application-web/node_modules/.pnpm/vite@5.4.21_@types+node@24.9.2_sass@1.65.1_terser@5.44.0/node_modules/vite/dist/node/chunks/dep-BK3b2jBa.js:65357:25)at async PluginDriver.hookFirstAndGetPlugin (file:///data/.jenkins/workspace/jg-inms-application-web/node_modules/.pnpm/rollup@4.52.5/node_modules/rollup/dist/es/shared/node-entry.js:22308:28)at async file:///data/.jenkins/workspace/jg-inms-application-web/node_modules/.pnpm/rollup@4.52.5/node_modules/rollup/dist/es/shared/node-entry.js:21308:33at async Queue.work (file:///data/.jenkins/workspace/jg-inms-application-web/node_modules/.pnpm/rollup@4.52.5/node_modules/rollup/dist/es/shared/node-entry.js:22536:32)[39mfind:/data/.jenkins/workspace/jg-inms-application-web/dist/: 没有那个文件或目录找出路径==>开始压缩/usr/bin/jenkins-web-package.sh:58:cd: /data/.jenkins/workspace/jg-inms-application-web/dist: 没有那个文件或目录zip warning: name not matched: developzip error: Nothing to do! (try: zip -r develop.zip . -i develop)[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline] { (远程部署)[Pipeline] sshPublisherSSH: Connecting from host [dev-centos]SSH: Connecting with configuration [192.168.100.90] ...SSH: Creating session: username [root], hostname [192.168.100.90], port [22]SSH: Connecting session ...SSH: ConnectedSSH: Opening SFTP channel ...SSH: SFTP channel openSSH: Connecting SFTP channel ...SSH: ConnectedSSH: cd [/]SSH: OKSSH: Opening exec channel ...SSH: EXEC: channel openSSH: EXEC: STDOUT/STDERR from command [bash /usr/bin/jenkins-web-deploy.sh jg-inms-application-web develop jg-inms-application-web] ...SSH: EXEC: connected开始解压缩unzip:  cannot find or open /data/java-project/jg-inms-application-web/develop.zip, /data/java-project/jg-inms-application-web/develop.zip.zip or /data/java-project/jg-inms-application-web/develop.zip.ZIP.mv: 无法获取'/usr/local/nginx/html/web/develop/jg-inms-application-web/develop/*' 的文件状态(stat): 没有那个文件或目录SSH: EXEC: completed after 200 msSSH: Disconnecting configuration [192.168.100.90] ...ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]][Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineFinished: UNSTABLE

原因: /components/MyUpload/index.vue文件引入大小写问题;
vue3文件引入大小写检查与修复


看到Jenkins部署Vue3项目失败了。从日志来看,问题链条比较清晰:Vite构建失败导致没有生成dist目录,进而导致后续的压缩和部署步骤失败。下面我帮你梳理一下问题和解决方案。

为了让你能快速把握核心疑问和应对方案,我先用一个表格来汇总主要的错误点、原因和解决方向:

错误阶段关键错误信息/现象可能原因/解决方案
Vite构建Could not load .../MyUpload/index.vue: ENOENT1. 文件缺失:确认MyUpload/index.vue文件是否存在。
2. 大小写敏感:检查文件名/路径大小写是否正确。
Vite构建component "IndexRange" ... has naming conflicts组件命名冲突:检查方案中是否有重复注册的同名组件。
后续步骤没有那个文件或目录, Nothing to do!构建失败连锁反应:Vite构建失败未生成dist目录,导致后续步骤(压缩、部署)失败。此问题会在Vite构建成功后自动解决。

详细分析与解决方案

1. 解决Vite构建失败(核心)

构建失败是当前所有问题的根源,主要需要解决两个错误。

2. 修复HTML中的脚本引用

日志中有一行提示:<script src="./config/basic.js"> in "/index.html" can't be bundled without type="module" attribute

  • 对于在 index.html 中直接引用的、不需要Vite处理的传统全局脚本,可以<script>标签上添加 type="module" 属性,或者更常见的做法是添加 rel="modulepreload"
3. 优化Jenkins流程与安装

通过在解决完构建障碍后,能够考虑优化Jenkins流程,避免类似问题。

总结与行动步骤

  1. 首要任务:登录Jenkins服务器,进入本次构建的工作空间目录,仔细检查并修复 /src/components/MyUpload/index.vue记录路径和大小写问题。这是最可能导致构建失败的环节。
  2. 次要清理:解决 index.html 中的脚本引用问题和组件命名冲突警告。
  3. 流程优化构建失败,则让Jenkins Pipeline直接终止,避免执行后续步骤。就是:在Vite构建步骤后,增加逻辑判断。若

希望这些步骤能帮助你快速定位并解决问题。如果排查了文件路径问题后依然失败,可以告诉我更多的上下文信息,例如MyUpload组件相关的导入代码,我们再一起分析。

http://www.jsqmd.com/news/54750/

相关文章:

  • 上海模型制作公司TOP5口碑排名:顺恒模型实力解析,破解沙盘
  • 转化成本降低45%+:2025高效豆包AI推广服务商推荐与解析
  • Vscode方块光标切换为竖线光标的办法
  • 2025年陶瓷PC砖直销厂家权威推荐榜单:石英砖/PC砖‌/仿石砖‌源头厂家精选
  • 2025年11月副业平台推荐榜:基于多维度数据的中立分析与选择指南
  • 2025年11月上海装修公司推荐:高性价比解决方案全解析
  • 2025年11月副业平台推荐榜:精选五大平台助力灵活创收
  • 2025年靠谱的热电偶温度传感器/防爆热电偶优质厂家推荐榜单
  • 2025年无菌冷灌玉米汁代加工厂家权威推荐榜单:OEM贴牌代工饮料/乳品代加工‌/谷物饮品代工‌源头厂家精选
  • Git可视化管理工具SourceTree管理代码仓库
  • 流量增长210%!5家豆包推广服务商实战案例与效果对比
  • 2025年知名的T型龙骨/龙骨热门厂家推荐榜单
  • AI元人文:探索内观照叙事模型的实现——从哲学构想到技术基石
  • 哪些公司可以做豆包AI推广,2025年12月最新发布榜单
  • 当下安徽枸杞制造企业推荐排行榜单
  • 2025年热门的新疆纯棉花棉被品牌厂家排行榜
  • 豆包AI推广服务商权威推荐,2025年12月最新发布
  • 2025 年长三角摄影培训机构推荐榜:路人贾(覆盖上海、江苏、浙江、安徽)实战至上、人像十杰创办
  • 2025年口碑好的冷拉型钢三角钢/冷拉型钢圆钢TOP品牌厂家排行榜
  • vue for devexpress report 集成到项目内的总结
  • 2025年比较好的冷拉异型钢厂家最新权威推荐排行榜
  • 2025年天文台生产厂推荐,天文台厂家怎么选
  • 2025年11月北京婚礼策划公司推荐:一份基于市场数据的客观选择列表
  • 完整教程:【Centos】服务器硬盘扩容之新加硬盘扩容到现有路径下
  • 2025年11月北京婚礼策划公司推荐:一份详尽的榜单与选择指南
  • 2025年知名的门座式起重机行业内口碑厂家排行榜
  • 2025 年摇臂钻床厂家最新推荐,摇臂钻床,3050 摇臂钻床 3080 摇臂钻床,3040 摇臂钻床,摇臂钻床厂家选择指南
  • 2025年11月儿童助听器验配机构市场报告:高性价比解决方案与避坑指南
  • 2025年11月助听器验配机构推荐榜单与选择指南:一份权威机构评测分析
  • 2025年靠谱的水性除味剂/皮革除味剂高评价厂家推荐榜