Windows开发环境
大约 4 分钟
端口命令
netstat -nao # 列出全部端口信息
netstat -aon | findstr "8081" # 查看被占用端口对应的 PID
tasklist | findstr "9088" # 查看指定 PID 的进程
taskkill /T /F /PID 9088 # 强制(/F参数)杀死 pid 为 9088 的所有进程包括子进程(/T参数)
git 设置
# 配置用户名
git config --global user.name "guangguang"
# 配置邮箱
git config --global user.email "dev@163.com"
# Git不用管换行符的事情
git config --global core.autocrlf false
# 编码配置
git config --global gui.encoding utf-8
# 避免status显示中文乱码
git config --global core.quotePath off
# 忽略文件名大小写
git config --global core.ignorecase false
# 生产本地用户的ssh key
ssh-keygen
npm uninstall -g vue-cli
npm install -g @vue/cli
node 配置
# 全局包存放位置 并将`C:\node\node_global`添加到环境变量Path中
npm config set prefix "C:\node\node_global"
npm config set cache "C:\node\node_cache"
# 查看当前源地址
npm config get registry
# 修改淘宝镜像地址
npm config set registry http://registry.npm.taobao.org/
# 还原默认镜像地址
npm config set registry https://registry.npmjs.org/
# 查看配置
npm config list
# 清除npm的缓存
npm cache clean -f
# 安装 yrm
npm install -g yrm
# 列出当前可用的所有镜像源
yrm ls
# npm ----- https://registry.npmjs.org/
# cnpm ---- http://r.cnpmjs.org/
# taobao -- https://registry.npm.taobao.org/
# nj ------ https://registry.nodejitsu.com/
# rednpm -- http://registry.mirror.cqupt.edu.cn
# skimdb -- https://skimdb.npmjs.com/registry
# yarn ---- https://registry.yarnpkg.com
# 使用淘宝镜像源
yrm use taobao
# 测试访问速度
yrm test taobao
yarn配置
npm install -g yarn
# 查看 yarn 配置
yarn config get registry
yarn config list
# 设置源地址
yarn config set registry https://registry.npm.taobao.org
yarn global remove vue-cli
yarn global add @vue/cli
pnpm配置
## 全局安装
npm install pnpm -g
pnpm --version
## 查看源
pnpm config get registry
## 切换源
# pnpm config set registry https://registry.npmjs.org/
# pnpm config set registry https://registry.npmmirror.com/
## 安装包
pnpm --registry https://registry.npmmirror.com install <包>
## 移除
pnpm remove <包>
pnpm remove <包> --global
## 更新
pnpm up
pnpm upgrade <包>
pnpm upgrade <包> --global
# 安装完记得重启下环境使其生效 | windows环境不好整就直接重启,重启后指定目录会生效
pnpm config set store-dir D:\\windows\\cache\\pnpm
## 个人使用 | 在系统上禁止使用脚本解决方法 | 以管理员身份运行power shell
set-executionpolicy remotesigned
vscode 设置
setings.json
{
//设置文字大小
"editor.fontSize": 18,
//设置文字行高
"editor.lineHeight": 26,
//开启行数提示
"editor.lineNumbers": "on",
// 在输入时显示含有参数文档和类型信息的小面板。
"editor.parameterHints.enabled": true,
// 调整窗口的缩放级别
"window.zoomLevel": 0,
// 文件目录
// "workbench.iconTheme": "vscode-icons",
// 设置字体
"editor.fontFamily": "'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
// 自动换行
"editor.wordWrap": "off",
// 自定义vscode面板颜色
"workbench.colorCustomizations": {
"tab.activeBackground": "#1E1E1E", // 活动选项卡的背景色
"activityBar.background": "#333333", //活动栏背景色
"sideBar.background": "#252526", //侧边栏背景色
"activityBar.foreground": "#f8fafa", //活动栏前景色(例如用于图标)
"editor.background": "#1E1E1E" //编辑器背景颜色
},
// vscode默认启用了根据文件类型自动设置tabsize的选项
"editor.detectIndentation": false,
// 重新设定tabsize
"editor.tabSize": 2,
// 每次保存的时候自动格式化
"editor.formatOnSave": false,
// 让函数(名)和后面的括号之间加个空格
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
// 这个按用户自身习惯选择
"vetur.format.defaultFormatter.html": "js-beautify-html",
// 让vue中的js按编辑器自带的ts格式进行格式化
"vetur.format.defaultFormatter.js": "vscode-typescript",
// 保存时运行的代码ESLint操作类型。
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
// 添加emmet支持vue文件
"emmet.includeLanguages": {
"wxml": "html",
"vue": "html"
},
// 两个选择器中是否换行
"minapp-vscode.disableAutoConfig": true,
// 快速预览(右侧)
"editor.minimap.enabled": true,
// tab 代码补全
"files.associations": {
"*.wpy": "vue",
"*.vue": "vue",
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript"
},
// 用来配置如何使用ESLint CLI引擎API启动ESLint。 默认为空选项
"eslint.options": {
"extensions": [".js", ".vue"]
},
// 在onSave还是onType时执行linter。默认为onType。
"eslint.run": "onSave",
// 启用ESLint作为已验证文件的格式化程序。
"eslint.format.enable": true,
// 语言标识符的数组,为此ESLint扩展应被激活,并应尝试验证文件。
"eslint.probe": ["javascript", "javascriptreact", "vue-html", "vue", "html"],
//关闭rg.exe进程 用cnpm导致会出现rg.exe占用内存很高
"search.followSymlinks": false,
// 给js-beautify-html设置属性隔断
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "auto",
"wrap_line_length": 200,
"end_with_newline": false
},
"prettyhtml": {
"printWidth": 200,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
},
"prettier": {
"semi": false,
"singleQuote": true
}
},
// style默认偏移一个indent
"vetur.format.styleInitialIndent": true,
// 定义匿名函数的函数关键字后面的空格处理。
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
// 定义函数参数括号前的空格处理方式。
"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
// 新版本消息
"vsicons.dontShowNewVersionMessage": true,
// 控制资源管理器是否在把文件删除到废纸篓时进行确认。
"explorer.confirmDelete": true,
// 使用eslint-plugin-vue验证<template>中的vue-html
"vetur.validation.template": false,
// 指定用在工作台中的颜色主题。
// "workbench.colorTheme": "One Dark Pro"
"window.menuBarVisibility": "classic",
"workbench.activityBar.visible": true,
"workbench.colorTheme": "Visual Studio Dark",
"workbench.editor.enablePreviewFromQuickOpen": false,
"workbench.statusBar.visible": true,
"workbench.sideBar.location": "left",
"workbench.startupEditor": "newUntitledFile",
"editor.renderIndentGuides": false,
"editor.highlightActiveIndentGuide": false,
"editor.suggestSelection": "first",
"explorer.confirmDragAndDrop": false,
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.autoSave": "afterDelay",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"java.home": "D:\\tools\\JDK\\jdk-11.0.10",
"java.errors.incompleteClasspath.severity": "ignore",
"java.jdt.ls.vmargs": "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication",
"java.configuration.maven.userSettings": "D:\\tools\\maven\\apache-maven-3.6.3\\conf\\settings.xml",
"java.configuration.maven.globalSettings": "D:\\tools\\maven\\apache-maven-3.6.3\\conf\\settings.xml",
"java.project.importOnFirstTimeStartup": "automatic",
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "D:\\tools\\JDK\\jdk1.8",
"default": true
},
{
"name": "JavaSE-11",
"path": "D:\\tools\\JDK\\jdk-11.0.10"
}
],
"java.debug.settings.exceptionBreakpoint.skipClasses": [],
"maven.executable.path": "D:\\tools\\maven\\apache-maven-3.6.3\\bin\\mvn.cmd",
"maven.terminal.useJavaHome": true,
"maven.terminal.customEnv": [
{
"environmentVariable": "JAVA_HOME",
"value": "D:\\tools\\JDK\\jdk-11.0.10"
}
],
"redhat.telemetry.enabled": true,
"workbench.editor.enablePreview": false,
"leetcode.endpoint": "leetcode-cn",
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"python.showStartPage": false,
"java.imports.gradle.wrapper.checksums": [
{
"sha256": "e2b82129ab64751fd40437007bd2f7f2afb3c6e41a9198e628650b22d5824a14",
"allowed": false
}
],
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
}
}