日常报错收集

147 阅读3分钟

Git提交报错问题

1. LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

解决方案:

git config --global --unset http.proxy git config --global --unset https.proxy

2. git变基处理

fatal: It seems that there is already a rebase-merge directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
        git rebase (--continue | --abort | --skip)
If that is not the case, please
        rm -fr ".git/rebase-merge"
and run me again.  I am stopping in case you still have something
valuable there.

解决方案:

  1. 解决变基问题:git rebase --continue
  2. 处理方式: rm -fr ".git/rebase-merge"然后再pull

3. Git stash 操作

  1. git stash drop stash@{1} 删除指定的git stash内容
  2. git stash clear 删除所有的stash 缓存

4.电脑打包时出现爆栈和内存溢出

解决方案:分发更大的编译和打包内存

NODE_OPTIONS=--max_old_space_size=4096

5.修改环境变量解决 command not found 问题

打开环境变量命令

open -e .bash_profile

编辑文件修改环境变量:

export PATH=~/.npm-global/bin:$PATH

保存修改,并运行修改后的文件

source ~/.bash_profile

6. Git .gitignore忽略文件编写规则和语法

语法作用
#.gitignore的注释
*.txt忽略所有.txt后缀的文件
!dist.txt忽略除dist.txt文件以外的其他所有文件
/mtk/忽略整个文件夹
.vscode忽略当前路径(根路径)的 .vscode后缀的文件
/bin忽略根目录下的 bin 文件
bin/忽略当前路径下的 bin 文件夹,该文件夹下的所有内容都会被忽略,不忽略 bin 文件
bin/*.txt忽略bin目录下所有 .txt 后缀的文件,但不包括bin子目录的 .txt 的文件
bin/dist.txt忽略当前bin/路径下的dist.txt文件

基本模版配置

.DS_Store
node_modules
/dist
/deploy

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
.zip
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

Jenkinsfile

.history
coverage

野生知识点

1.流数据下载zip包,blob格式下载出来是一个xml格式的文件

解决方案:

后端在blob数据流格式type中需要表明下载的格式是zip包格式。

2.三维cesium.js中没有指南针、比例尺、缩放功能,如何实现它没有的这些罗盘功能。

解决方案:cesium-navigation-es6

地址:github.com/richard1015…

3.安全漏洞检测:vue项目部署后检测到目标站点存在javascript框架库漏洞

问题详情:vue项目打包后chunk的js文件出现引用YUI版本漏洞,

image.png

原因分析:

项目中使用了rsa加密jsencrypt,用npm 安装到项目的jsencrypt是没有压缩的,里面包含YUI打包之后会出现这种文件。 由于一般用户登陆密码加密都采用的是Jsencrypt.js的加密方案,但是Jsencrypt在文件采用了YaHoo的YUI类库,npm在安装Jsencrypt时未进行压缩处理,导致vue在打包后chunk文件出现了YUI漏洞问题

解决方案:

  1. 升级Jsencrypt版本
  2. 直接引用引用jsencrypt.min.js压缩包,进行全部使用,替换之前的Jsencrypt引入。

4.流文件下载后出现文件损坏无法打开

问题详情:后端返回数据结构为二进制数据流格式,前端采用blob方式去处理数据流,正常下载后打开文件出现文件损坏无法打开。

解决方案:

  1. 排查是否是因为文件后缀格式错误导致的,
  2. 排查是否是因为文件在下载过程中存在问题

过程中存在问题:

在axios请求中一定要添加 responseType: "blob",确保下载格式是blob。

后期blob处理

const blobUrl = window.URL.createObjectURL(blob);
   
  navigator.msSaveBlob(blobUrl, filename);
  
  window.URL.revokeObjectURL(blobUrl);