# 1.node的安装 进入[node](https://nodejs.org/zh-cn/)官网下载安装包 安装选择下面选项 ![image-20210911173404485](../../照片/image-20210911173404485.png) # 2.更改npm和yarn依赖包全局下载和缓存路径 1. 在 D盘新建一个目录,用来存放 npm 或 yarn 的 cache 和 依赖包文件 ``` D:\node_package\npm D:\node_package\npm_cache D:\node_package\yarn D:\node_package\yarn_cache ``` 2. 更改npm 和 yarn 的配置 ``` # npm npm config set prefix "D:\node_package\npm" npm config set cache "D:\node_package\npm_cache" npm config set registry https://registry.npm.taobao.org/ # yarn yarn config set global-folder "D:\node_package\yarn" yarn config set cache-folder "D:\node_package\yarn_cache" yarn config set registry https://registry.npm.taobao.org/ ``` 3. 查看配置 ``` # npm npm config list # yarn yarn config list ``` 4. 为了让安装的包,能在控制台使用,需要配置 Path 环境变量 1) 新建 NODE_PATH 环境变量 ![image-20210911173714273](../../照片/image-20210911173714273.png) 2) 在 Path 中添加如下路径 ![image-20211130152530439](assets/image-20211130152530439.png)