前端常用命令集

4 篇文章 0 订阅
3 篇文章 0 订阅

NVM

nvm可下node版本
配置

// 打开nvm安装路径
nvm root
// 在settings.txt中加入:
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/

基础指令

// 查看所有安装版本
nvm ls
// 查看系统架构和当前node架构位数
nvm arch
// 查看NVM可以安装的node环境(部分)
nvm list available
// 下载node版本12.22.12
nvm install 12.22.12
// 卸载node版本
nvm uninstall xxx
// 切换node版本
nvm use 12.22.12
// 查看nvm的安装目录
nvm root
// 查看nvm版本
nvm v

32位

// 下载32位某版node
nvm install 12.22.12 32
// 使用32位某版node
nvm use 12.22.12 32

NPM

配置

// 直接打开配置文件编辑
npm config edit
// npm registry
npm config set registry https://registry.npmmirror.com/
// electron
npm config set ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
// electron-builder
npm config set ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/

基础指令

// 查看版本
npm -V
// npm 初始化
npm init 
// node 运行文件
node server.js
// npm 搜索包
npm search xxx
// npm 下载包
npm install xxx
// npm 全局安装
npm install xxx -g
// npm 卸载依赖
npm uninstall xxx
// npm 卸载开发依赖
npm uninstall -D xxx

常用指令

// npm 查看某个依赖包的版本
npm ls xxx 
npm ls xxx -g
// npm 检查源
npm config get registry
// npm 切换源为淘宝源
npm config set registry https://registry.npmmirror.com/
// npm 切换源为官方源
npm config set registry https://registry.npmjs.org

// npm下载并保存到开发环境
npm i xxx --save-dev
npm i xxx -D
// npm 下载并保存到生产环境
npm i xxx--production

yarn

// 下载yarn
npm install yarn -g
// 查看yarn 版本
yarn --version
// 查看yarn配置
yarn config list

// 项目依赖下载,报错info在项目目录的yarn-error.log
yarn
// 下载某依赖
yarn add xxx
// 更换淘宝镜像
yarn config set registry https://registry.npmmirror.com
// 取消严格ssl
yarn config set strict-ssl false

// 运行项目
yarn serve
// 打包
yarn build

Python

基础指令

// py文件运行
python xxx.py
// py版本
python -V
// pip 升级
python -m pip install --upgrade pip

虚拟环境

// 创建venv虚拟环境文件夹 (venv已内置)
python -m venv venv
// 激活环境(执行activate, 路径原因不一而足)
./venv/Scripts/activate 
// 退出环境(执行decativate)
./venv/Scripts/deactivate 

// venv内只能生成新的环境提供包的下载,无法完成python版本的切换
// 比如我想用32位的python 3.7
// 思路①:下载该版本,python.exe文件名修改python32.exe,
//        pip.exe也要修改pip32.exe,添加到环境变量
//        使用 python32 -m venv venv
// 思路②:下载该版本,默认添加path,
//        使用pycharm选择解释器,基于新下的版本生成venv

pip指令

// pip 下载
pip install xxx
// pip 指定版本
pip install django==4.0.4
// pip 已下载列表
pip list
// pip 查看已下载的某包
pip show xxx
// pip 永久换源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
// 国内镜像:
http://mirrors.aliyun.com/pypi/simple/ //阿里云
http://pypi.douban.com/simple/         //豆瓣   
https://pypi.tuna.tsinghua.edu.cn/simple/   //清华
http://pypi.mirrors.ustc.edu.cn/simple/     //中科大


// pip 临时换源下载安装(加信任)
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn xxx
// pip 按照requirements.txt文件下载环境
pip install -r requirements.txt
// pip 保存当前项目包依赖(强烈推荐)
pip freeze >> requirements.txt

GIT

常用命令

git init <directory> 		  	      // 初始化本地仓库
git clone <url>      		    	  // 克隆远程代码仓

git status             				   //查看当前分支
git branch          			       //显示分支 (-a 所有分支、-r远程分支)
git checkout <branch>                  //切换分支
git checkout -b <branch>               //新建分支并切换
git checkout -b mybranch origin/branch //拉取远程分支origin/branch到本地并创建关联分支

git add .                             //添加全部文件到暂存区
git commit -m "message"               //添加commit提交

git pull <remote name> <branch>       //拉取分支
git push <remote name> <branch>       //推送到特定分支
git push <remote name> <branch> -f    //强制推送覆盖

git 配置

// 用户身份
git config --global user.name 'xxxName' 
git config --global user.email 'xxxEMAIL'

// 添加远程仓库
git remote add origin https://github.com/xxxxxxx/repository.git
// 修改远程仓库
git remote set-url origin https://github.com/xxxxxx.git

// 配置push默认对应远程分支
git push --set-upstream origin master
// [成功提示]
// > Everything up-to-date
// > branch 'master' set up to track 'origin/master'.

// 生成密钥 (用户的.ssh文件夹下生成id_rsa,id_rsa.pub文件)
ssh-keygen -t rsa -C "xxxEMAIL"

关联分支

// 新建本地分支同时与远程分支关联 (经典场景>代码拉下来看看跑一下)
git checkout -b [newbranch] [origin/branch]

// push到远程分支同时关联该分支 (经典场景>项目仓还是空的,第一次上传)
git push --set-upstream origin [localbranch]:[origin/branch]
git push --set-upstream origin [branch]

// git branch关联,无多余动作
git branch --set-upstream-to=[origin/banch] [localbranch] 

windows

常用指令

// 进入D盘
D:
// 进入路径
cd xxx
// 查看本机ip
ipconfig
// 创建目录
md xxx
// 删除目录
rd xxx
// 查看目录文件
dir
// 复制文件
copy ./xx/readme.md ./yy/readme.md
......

查询端口状态并杀死进程:

netstat -ano|find "8080"
taskkill /PID 1234 /F
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值