• DevOps
  • Jenkins 部署 vue 项目打包失败

创建部署问题时,请参考下面模板,你提供的信息越多,越容易及时获得解答。如果未按模板创建问题,管理员有权关闭问题。
确保帖子格式清晰易读,用 markdown code block 语法格式化代码块。
你只花一分钟创建的问题,不能指望别人花上半个小时给你解答。

操作系统信息
Centos7

Kubernetes版本信息
Kubernetes v1.22.3

KubeSphere版本信息
Kubesphere v3.2.0

问题是什么
目前想通过 Kubesphere Jenkins CI/DI 自动部署前端 Vue 项目,在 npm install 的时候一直失败。目测报错信息是请求 github 资源超时。报错信息如下:

npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! code 128
npm ERR! Command failed: git clone --depth=1 -q -b fix/ie-cannot-input-korean https://github.com/sohee-lee7/Squire.git /root/.npm/_cacache/tmp/git-clone-818b065e
npm ERR! warning: templates not found /tmp/pacote-git-template-tmp/git-clone-c2aed7bf
npm ERR! fatal: unable to access 'https://github.com/sohee-lee7/Squire.git/': Encountered end of file
npm ERR! 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-11-25T08_59_32_698Z-debug.log
  • 查看 jenkins 中 nodejs 和 npm 的版本分别为 npm -v 6.9.0 ;node -v v10.16.3

  • 尝试解决办法如下:

    1. 通过 git config --global url."https://".insteadOf git:// 替换https。结果:不行!

    2. 通过淘宝镜像源注册 cnpm install 。结果:不行!

      由于是后端开发,对前端没有深入了解。有没有资深大佬解惑 😀

    johnniang

    是的哈哈尝试各种方法打通服务器和 Github 网络问题,终于搞定了。感谢大佬的启发!