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

.npmrc

registry=https://registry.npm.taobao.org
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=http://cnpmjs.org/downloads
electron_mirror=https://npm.taobao.org/mirrors/electron/
sqlite3_binary_host_mirror=https://foxgis.oss-cn-shanghai.aliyuncs.com/
profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
chromedriver_cdnurl=https://cdn.npm.taobao.org/dist/chromedriver

.yarnrc

registry "https://registry.npm.taobao.org"
sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
phantomjs_cdnurl "http://cnpmjs.org/downloads"
electron_mirror "https://npm.taobao.org/mirrors/electron/"
sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/"
chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"
posted @ 2020-05-01 22:19  呓语i  阅读(252)  评论(0编辑  收藏  举报