1. Win Command

  • command_one & command_two
    command_one和command_two都会执行

  • command_one && command_two
    command_one运行成功,没出错才运行command_two

  • command_one || command_two
    command_one运行不成功,出错才运行command_two

2. Node安装

  • 安装 Node V20.12.2 X64

  • 设置PATH:D:\Install\Antora\Node

node -v && npm -v

v20.12.2
10.5.0
  • 所有安装都将采用global方式安装及卸载

3. Production

PATH:D:\Install\Antora\Node

npm config set cache "D:/Install/Antora/Node/NodeCache"

# 此处考虑到antora,设置路径为D:/Install/Antora/Node
# npm config set prefix "D:/Install/Antora/Node/NodePrefix"
npm config set prefix "D:/Install/Antora/Node"

4. Config List

npm config list -l

npm config list --json

npm config list

5. Config Get

npm config get <key> ...

npm config get cache prefix registry

6. Delete

npm config delete <key> ...

npm config delete cache prefix

7. Set

npm config set <key>=<value>...

npm config set cache "D:/Install/Antora/Node/NodeCache"

npm config set prefix "D:/Install/Antora/Node/NodePrefix"

npm config set registry https://registry.npmjs.org

npm config set registry https://registry.npm.taobao.org

8. Install

  • 因非专业前端工程师,故选择使用全局node_modules

# 本地安装
npm i packageName@version

# 全局安装
npm i -g packageName@version...

# 安装时,将包引入到package.json
npm i packageName@version --save

9. Install Directory

# 本地安装目录
npm root

# 全局安装目录
npm root -g

10. Uninstall

# 本地卸载
npm uninstall packageName

# 全局卸载
npm uninstall packageName -g

11. Update

# 本地更新包
npm update packageName

# 全局更新包
npm update packageName -g

12. List

# 查看本地已安装包列表
npm ls

# 查看全局已安装包列表
npm ls -g

npm ls --depth=0 && npm ls -g --depth=0

13. Mirror

npm config set registry https://registry.npm.taobao.org

npm config get registry

14. Cache

npm cache clean --force

15. Prefix

npm prefix && npm prefix -g

# bin文件链接到
${PREFIX}/bin

# 手册链接到
${PREFIX}/share/man

# 包安装到
${PREFIX}/lib/node_modules