npm安装及下载路径配置
npm默认的本地仓库在系统盘c盘的用户目录了 C:\Users\${username}\AppData\Roaming
为了方便管理,我们也将这些文件都放置在d盘的store\nodejs中
现在d盘建立目录D:\store\nodejs
通过以下命令设置
npm config set prefix "D:\store\nodejs"
npm config set cache "D:\store\nodejs"
npm config set registry=http://registry.npm.taobao.org
通过npm config list查看当前配置:
$ npm config list
; "builtin" config from D:\store\nodejs\node_modules\npm\npmrc
; prefix = "C:\\Users\\wang-\\AppData\\Roaming\\npm" ; overridden by user
; "user" config from C:\Users\wang-\.npmrc
cache = "D:\\store\\nodejs"
prefix = "D:\\store\\nodejs"
registry = "http://registry.npm.taobao.org/"
; node bin location = D:\Program Files\nodejs\node.exe
; node version = v16.14.2
; npm local prefix = D:\store\nodejs
; npm version = 8.10.0
; cwd = D:\store\nodejs
; HOME = C:\Users\wang-
; Run `npm config ls -l` to show all defaults.
升级npm
npm install npm -g
安装yarn
npm install yarn -g
文章评论