Vue前端编译问题集

问题描述

最近编译一个前端项目,遇到了好几个错误,各种尝试,总算是都解决了,失败41次,成功了,忍不住要热泪盈眶了。

问题1 error: unknown option `show-current’

npm run build执行后,报这个错误:

npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error:
connect ETIMEDOUT 104.20.22.46:443 npm ERR! gyp ERR! stack at
TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) npm ERR!
gyp ERR! System Linux 3.10.0-1160.24.1.el7.x86_64 npm ERR! gyp ERR!
command “/usr/bin/node”
“/home/jenkins/workspace/msp_vue_dashboard-monitor_build_package/node_modules/node-gyp/bin/node-gyp.js”
“rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=”
“–libsass_ldflags=” “–libsass_library=” npm ERR! gyp ERR! cwd
/home/jenkins/workspace/msp_vue_dashboard-monitor_build_package/node_modules/node-sass
npm ERR! gyp ERR! node -v v12.22.4 npm ERR! gyp ERR! node-gyp -v
v3.8.0 npm ERR! gyp ERR! not ok npm ERR! Build failed with error
code: 1

npm ERR! A complete log of this run can be found in: npm ERR!
/root/.npm/_logs/2022-10-10T09_34_44_595Z-debug.log bash: eixt:
command not found

vue-ele-pro@1.0.0 build
node preBuild.js && vue-cli-service build

error: unknown option `show-current’ 用法:git branch [选项] [-r | -a]
[–merged | --no-merged] 或:git branch [选项] [-l] [-f] <分支名> [<起始点>]
或:git branch [选项] [-r] (-d | -D) <分支名>… 或:git branch [选项] (-m |
-M) [<旧分支>] <新分支>

通用选项
-v, --verbose 显示哈希值和主题,若参数出现两次则显示上游分支
-q, --quiet 不显示信息
-t, --track 设置跟踪模式(参见 git-pull(1))
–set-upstream 改变上游信息
-u, --set-upstream-to
change the upstream info
–unset-upstream Unset the upstream info
–color[=<何时>] 使用彩色输出
-r, --remotes 作用于远程跟踪分支
–contains <提交> 只打印包含该提交的分支
–abbrev[=] 用 位数字显示 SHA-1 哈希值

具体的 git-branch 动作:
-a, --all 列出远程跟踪及本地分支
-d, --delete 删除完全合并的分支
-D 删除分支(即使没有合并)
-m, --move 移动/重命名一个分支,以及它的引用日志
-M 移动/重命名一个分支,即使目标已存在
–list 列出分支名
-l, --create-reflog 创建分支的引用日志
–edit-description 标记分支的描述
-f, --force 强制创建(当已经存在)
–no-merged <提交> 只打印没有合并的分支
–merged <提交> 只打印合并的分支
–column[=<风格>] 以列的方式显示分支

child_process.js:674
throw err;
^

Error: Command failed: git branch --show-current error: unknown option
`show-current’ 用法:git branch [选项] [-r | -a] [–merged | --no-merged]
或:git branch [选项] [-l] [-f] <分支名> [<起始点>] 或:git branch [选项] [-r] (-d
| -D) <分支名>… 或:git branch [选项] (-m | -M) [<旧分支>] <新分支>

通用选项
-v, --verbose 显示哈希值和主题,若参数出现两次则显示上游分支
-q, --quiet 不显示信息
-t, --track 设置跟踪模式(参见 git-pull(1))
–set-upstream 改变上游信息
-u, --set-upstream-to
change the upstream info
–unset-upstream Unset the upstream info
–color[=<何时>] 使用彩色输出
-r, --remotes 作用于远程跟踪分支
–contains <提交> 只打印包含该提交的分支
–abbrev[=] 用 位数字显示 SHA-1 哈希值

具体的 git-branch 动作:
-a, --all 列出远程跟踪及本地分支
-d, --delete 删除完全合并的分支
-D 删除分支(即使没有合并)
-m, --move 移动/重命名一个分支,以及它的引用日志
-M 移动/重命名一个分支,即使目标已存在
–list 列出分支名
-l, --create-reflog 创建分支的引用日志
–edit-description 标记分支的描述
-f, --force 强制创建(当已经存在)
–no-merged <提交> 只打印没有合并的分支
–merged <提交> 只打印合并的分支
–column[=<风格>] 以列的方式显示分支

at checkExecSyncError (child_process.js:635:11)
at Object.execSync (child_process.js:671:15)
at Object.<anonymous> (/home/jenkins/workspace/msp_vue_dashboard-monitor_build_package/preBuild.js:13:30)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {   status: 129,   signal: null,   output: [
null,
Buffer(0) [Uint8Array] [],
Buffer(1663) [Uint8Array] [
  101, 114, 114, 111, 114,  58,  32, 117, 110, 107, 110, 111,
  119, 110,  32, 111, 112, 116, 105, 111, 110,  32,  96, 115,
  104, 111, 119,  45,  99, 117, 114, 114, 101, 110, 116,  39,
   10, 231, 148, 168, 230, 179, 149, 239, 188, 154, 103, 105,
  116,  32,  98, 114,  97, 110,  99, 104,  32,  91, 233, 128,
  137, 233, 161, 185,  93,  32,  91,  45, 114,  32, 124,  32,
   45,  97,  93,  32,  91,  45,  45, 109, 101, 114, 103, 101,
  100,  32, 124,  32,  45,  45, 110, 111,  45, 109, 101, 114,
  103, 101, 100,  93,
  ... 1563 more items
]   ],   pid: 60786,   stdout: Buffer(0) [Uint8Array] [],   stderr: Buffer(1663) [Uint8Array] [
101, 114, 114, 111, 114,  58,  32, 117, 110, 107, 110, 111,
119, 110,  32, 111, 112, 116, 105, 111, 110,  32,  96, 115,
104, 111, 119,  45,  99, 117, 114, 114, 101, 110, 116,  39,
 10, 231, 148, 168, 230, 179, 149, 239, 188, 154, 103, 105,
116,  32,  98, 114,  97, 110,  99, 104,  32,  91, 233, 128,
137, 233, 161, 185,  93,  32,  91,  45, 114,  32, 124,  32,
 45,  97,  93,  32,  91,  45,  45, 109, 101, 114, 103, 101,
100,  32, 124,  32,  45,  45, 110, 111,  45, 109, 101, 114,
103, 101, 100,  93,
... 1563 more items   ] } Build step 'Execute shell' marked build as failure

问题1解决方案

搞了半天才明白,这是个git错误,而不是npm编译的错误,其原因是Centos7.5自带的git版本是1.8.3, 而命令git branch --show-current 需要git 2.22版本以上才支持。 而git是jenkins初始安装的时候配置的,怎么也没想到这么快因为这个版本问题导致了这个错误。失误失误,教训深刻!!!!

问题2:npm ERR! fatal: 无法访问 ‘https://github.com/adobe-webplatform/eve.git/’:Encountered end of file

坦白说,这是一个烂大街的问题,这个问题很奇怪,我在jenkins服务器上直接运行npm install && npm run build,就没出现这个问题。但是在jenkins的shell中执行,就遇到了这个问题。

而且,这个问题查找CSDN,基本上都是让执行:

git config --global url.“https://”.insteadOf git://

但问题是,执行了这个后,问题还存在,最后,终于在另一个文档中,发现还需要再执行如下配置才可以解决:

git config --global http.sslverify “false”

问题3 上面配置后,在同时编译很多npm代码库的时候,又碰到牛皮糖问题:npm ERR! /bin/git ls-remote -h -t git://github.com/adobe-webplatform/eve.git

npm ERR! Error while executing:
npm ERR! /bin/git ls-remote -h -t git://github.com/adobe-webplatform/eve.git
npm ERR!
npm ERR! fatal: 无法访问 ‘https://github.com/adobe-webplatform/eve.git/’:Encountered end of file
npm ERR!
npm ERR! exited with error code: 128

这个问题,看来是执行的时候,跳过了我本地.gitconfig中的2个配置:
[url “https://”]
insteadOf = git://
[http]
sslverify = false

解决方法:

git config --global url."https://gitclone.com/github.com/adobe-webplatform/eve.git".insteadOf "git://github.com/adobe-webplatform/eve.git"

记之。

感谢

问题解决过程中参考了这些有意义的博客,感谢他们:
[1]: https://www.dounaite.com/article/62a0cf340eb48b8cec7ad144.html
[2]: https://ping.chinaz.com/ (查找github.com的IP网址)
[3]: https://madmalls.com/blog/post/how-to-install-latest-version-of-git-git-2-x-on-centos-7/ (centos7安装git 2.x版本)
[4]: https://stackoverflow.com/questions/6245570/how-do-i-get-the-current-branch-name-in-git (解决问题最给力的网站stackoverflow)

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值