笔记

本文不定期更新。 每次会更新会把新的信息更新在顶部,方便我自己阅读。

# npm 命令

npm outdated  # 查看版本落后的npm包
npm update    # 更新本地包,仅能更新小版本

npm install packageName@Y           # 升级大版本号
npm install packageName@oldVersion  # 降级版本号
# 在安装命令添加参数--verbose看打印详细信息

npm config get registry                                    # 查看npm当前镜像源
npm config set registry https://registry.npm.taobao.org/   # 设置npm镜像源为淘宝镜像

yarn config get registry                                   # 查看yarn当前镜像源
yarn config set registry https://registry.npm.taobao.org/  # 设置yarn镜像源为淘宝镜像
1
2
3
4
5
6
7
8
9
10
11
12

# 配置终端代理

# TODO: 有空需要验证一遍,至少要验证mac平台

# 验证代理
curl cip.cc
# curl谷歌可能会遇到403
curl -I http://www.google.com


# 终端代理

# MacOS & Linux & Windows平台下的Git Bash
export http_proxy=http://127.0.0.1:1080
export https_proxy=http://127.0.0.1:1080

unset http_proxy https_proxy

# Windows cmd
set http_proxy=http://127.0.0.1:1080
set https_proxy=http://127.0.0.1:1080

set http_proxy=
set https_proxy=

# Windows PowerShell
$env:http_proxy="http://127.0.0.1:1080"
$env:https_proxy="http://127.0.0.1:1080"

$env:http_proxy=""
$env:https_proxy=""


# git代理
git config --global http.sslBackend "openssl"
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

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

# npm代理
npm config set proxy http://127.0.0.1:1080
npm config set https-proxy http://127.0.0.1:1080

npm config delete proxy
npm config delete https-proxy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

# homebrew 切换 node 版本

brew unlink node
brew link --overwrite node@14
1
2

# zsh 相关

# 配置文件

zsh 有很多配置文件,其中系统级的在/etc文件夹下,用户级的在~/文件夹下。

  • .zshenv: 所有 zsh 实例启动时都会加载.
  • .zprofile: 当前 shell 为 login shell 时才会加载.
  • .zshrc: 当前 shell 为 interactive shell 时才会加载.
  • .zlogin: 当前 shell 为 login shell 时才会加载.
  • .zlogout: login shell 退出时加载, 用于清理环境.

# 更改 .zcompdump 位置

参考stackoverflow (opens new window)还没看

# 参考文档