20200714——git/mac配置/项目运行步骤/一些报错

目录

1.svn/git

2.Mac vue环境配置

3.一些 git命令

3.1 git 全局配置

3.2 分支 branch

3.3 克隆代码 git clone

3.4 CI集成测试

4.运行克隆后的项目过程

5.遇到的报错

5.1 提示:找不到模块

5.2 node-pre-gyp WARN Using request for node-pre-gyp https download

5.3 报错信息:error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! luban-box@1.0.0 serve: `cd app && yarn serve`

npm ERR! Exit status 1


1.svn/git

  • 分布式:GIT工作模式下,每个开发者(安装了git客户端)的电脑 就等同于 传统SVN服务器
  1. svn工作模式:commit 后完成提交
  2. git工作模式:commit 后需要继续 push 完成提交
  • Gitlab:如果是企业级开发,为了团队协作及保密问题,采用 gitlab
  • github:如果是私人开发,愿意共享,可以考虑
  • GitLab 拥有 GitHub拥有的一切,甚至更多

 

2.Mac vue环境配置

  • 安装 node.js(查看版本号:node -v,npm -v):官网
  • 安装 vue cli (查看版本号:vue -V):
  • sudo npm install -g cnpm --registry=https://registry.npm.taobao.org

    sudo cnpm install -g vue-cli

  • 安装 git(查看版本号:git --version):Xcode Command Line Tools

  • typescript 中文文档:https://legacy.gitbook.com/book/zhongsp/typescript-handbook/detail

  • mac一些其他配置:触控轻击,vscode,chorme
  • 我的 vscode插件:20200714——git/mac配置/项目运行步骤/一些报错_第1张图片
  • Mac 使用管理员权限进行操作:sudo + npm语句

  • 会要求输入密码,苹果的特性是:输入密码毫无效果,输入完成直接回车即可

  • Password:xxx

 

3.一些 git命令

3.1 git 全局配置

  1. git config --global user.name zly

  2. git config --global user.email ...

3.2 分支 branch

  • 查看远程仓库:$ git remote -v
  • 查看远程分支:$ git branch -r
  • 查看本地分支:$ git branch
  • 在本地创建并切换到新分支:git checkout -b release-1.0.0-feature/zly_addList_20200714
  • 关联远程仓库地址:git remote add origin git@code....

 

  • 在远程仓库新建自己的分支:20200714——git/mac配置/项目运行步骤/一些报错_第2张图片
  • 输入 git branch 不显示分支的原因:必须在执行完 git init/add/commit 命令之后,才能查看分支

3.3 克隆代码 git clone

  • 上传过程;git add . / git status / git commit -m "feat: zly first commit" / git push 

 

  • 如何从 gitlab 上克隆 指定项目分支
  • 新建文件夹,并命名为自己的分支,git init 初始化 .git文件夹
  • 克隆指定分支:git clone -b <分支名> <仓库地址>

  • git clone -b release-1.0.6-feature/al_20200713 https://code.hz...

3.4 CI集成测试

  • .gitlab-ci.yml:这个文件中的内容全部删除,添加如下代码:
image: node:10.15.3

stages:
  - deploy1

app_deploy:
  stage: deploy1
  script:
    - node ./
  only:
    - /^release.*$/
  • node.js 默认打开 index.js,所以要在根目录下创建 index.js,随便输出一些内容
  • 将代码 push到远程仓库 自己的分支中,就会自动执行 CI测试,如下图;
  • 20200714——git/mac配置/项目运行步骤/一些报错_第3张图片

 

4.运行克隆后的项目过程

  • 在项目文件夹中打开终端,安装下面两个模块:
  1. 前端规范文档 mainto-cli :sudo npm install mainto-cli -g --registry https://npm.code.hzm...
  2. mt组件文档:npm install @mainto-ui-component/vue  --registry https://npm.code.hzm...
  • npm install 安装剩余模块
  • 运行项目:npm run serve

 

5.遇到的报错

5.1 提示:找不到模块

  • 先检查自己是否在 正确的文件夹下 打开终端
  • 解决方案一:失败
  • sudo rm -rf node_modules package-lock.json && npm install
  • 解决方案二:成功
  • 全局安装:sudo npm install @vue/cli-service -g

5.2 node-pre-gyp WARN Using request for node-pre-gyp https download

  • 在安装 cavans模块的过程中,出现卡死的问题,提示上面代码
  • 原因;从 github 上下载 c++的编译包太慢
  • 解决方案:control c 打断当前程序执行 ,单独从淘宝镜像下载 canvas
  • npm install canvas --canvas_binary_host_mirror=https://npm.taobao.org/mirrors/node-canvas-prebuilt/

5.3 报错信息:error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! luban-box@1.0.0 serve: `cd app && yarn serve`

npm ERR! Exit status 1

  • 问题:目录问题,应该在 mainto-projects-show 下打开终端,进行环境安装
  • meowtea@MeowdeMacBook-Pro pages % ls 查看当前目录
  • mainto-projects-show    ops-deploy
  • meowtea@MeowdeMacBook-Pro pages % cd mainto-projects-show 跳转到指定目录
  • meowtea@MeowdeMacBook-Pro mainto-projects-show % yarn 执行所有安装

 

你可能感兴趣的:(日记)