前端开发环境搭建

前言

前几天因为电脑重装系统,前端环境需要重新搭建的问题也随之而来,虽然前端环境搭建并没有多么繁琐,但是也不想为了这种机械的配置流程去占用脑内存;即使记得,在实际配置时也可能遗漏一二,所以本篇博文它来了,它来了ing…

一、安装node

1
// 官网:https://nodejs.org/en/download/

二、安装nvm

1
2
3
4
5
6
7
8
9
npm install nvm -g // 切换或安装node版本

常用命令
nvm use // 切换node版本
nvm ls // 列出所有安装的版本
nvm current //显示当前的版本
nvm install // 如:nvm install v6.2.0
nvm uninstall // 如: nvm uninstall v6.2.0
nvm ls-remote // 列出所以远程服务器的版本(官方node version list)

三、安装nrm

1
2
3
4
5
6
npm install nrm -g // 切换npm下载源

常用命令
nrm ls 列出可用的源
nrm use 选择下载源
nrm del 删除下载源

四、安装git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 官网 https://git-scm.com/download
常用命令
http://lecode.ltd/2018/03/07/git使用/#more

// 配置密钥
生成密钥 ssh-keygen -t rsa -C "yourmail@xxx.com"
// 添加公钥到gitlab
登陆gitlab后,到该路径下 /profile/keys
再到本地 C:\Users\lien\.ssh目录下,拷贝.pub文件内容
粘贴到Key对应的textarea里


// 配置git用户
git config --global user.email yourmail@xxx.com
git config --global user.name yourname

// Windows使用回车(CR)和换行(LF)两个字符来结束一行,可以关闭掉
git config --global core.autocrlf false
// mac、linux系统下开发,将回车(CR)和换行(LF)转换成换行
git config --global core.autocrlf input

// 更多git的自定义配置
https://git-scm.com/book/zh/v2/自定义-Git-配置-Git

五、安装VSCode

1
2
3
4
5
6
7
8
9
10
// 官网:https://code.visualstudio.com/
常用插件
Auto Close Tag
Auto Rename Tag
Path Intellisense
GitLens
ESLint (TSlint 已于2019年弃用)

常用设置
http://lecode.ltd/2018/03/28/VSCode使用/

六、安装chrome

1
2
3
4
5
6
7
8
// 必须项
安装谷歌访问助手(谷歌商店已经下架,需要自己提前打包备份好)
安装沙拉查词(你需要它~)
// 可选项
安装 JSON Viewer
安装 Axure RP Extension for Chrome
安装 Altair GraphQL Client
...