Node 基本配置

默认安装路径

C:/用户/[用户名]/AppData/Roming/npm/node_meodules

修改

查看配置信息

npm config ls

创建文件夹并重新设置

# win 
npm config set prefix "D:\software\nodejs\meodules\npm"
npm config set cache "D:\software\nodejs\meodules\npm\cache"
# linux
npm config set prefix "/opt/software/node"
npm config set cache "/opt/software/node/cache"

下载的包信息

cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org	

添加 npm 下载配置

# 将淘宝镜像添加在本地配置中 以后直接使用该配置
npm config set registry https://registry.npm.taobao.org
# 仅本次下载使用淘宝的镜像
npm --registry https://registry.npm.taobao.org install express

配置后可通过下面方式来验证是否成功

npm config get registry

npm info express

猜你喜欢

转载自www.cnblogs.com/iFanLiwei/p/12815113.html
今日推荐