# 镜像源配置 registry=https://registry.npmmirror.com/ # registry=https://registry.npmjs.org/ @tianyio:registry=https://registry.npmjs.org/ @tcsl:registry=http://192.168.4.34:4873/ # 认证与安全 # 不强制所有包都需要认证(私有包除外) always-auth=false # SSL 安全检查 strict-ssl=true cafile= cert= key= # 检查证书有效性 fetch-retry-mintimeout=10000 fetch-retry-maxtimeout=60000 # 网络与性能 # 超时与重试 timeout=300000 fetch-timeout=300000 fetch-retries=3 # 并发控制(避免大量请求阻塞) maxsockets=16 maxhttpsockets=16 maxfiles=10000 # 缓存设置(7天) cache-max=7 cache-min=10 cache=c:/npm-cache # Windows 默认路径,其他系统会自动识别 ~/.npm # Linux/macOS 用户可注释上行,使用默认路径 # 依赖行为 # 保存依赖时使用 ^ 前缀 save-prefix=^ # 不保存精确版本 save-exact=false # 忽略可选依赖错误(如 fsevents 在 Windows 上) optional=false # 处理对等依赖:npm 不自动安装 peer deps,但可警告 legacy-peer-deps=false # npm v7+ 默认为 false,保留以明确意图 # 安全与审计 # 启用审计 audit=true audit-level=moderate # 不显示资金请求 fund=false # 输出与日志 loglevel=warn progress=true color=always unicode=true # 脚本与执行 ignore-scripts=false ignore-prepublish=false enable-pre-post-scripts=true # 其他 # 启用符号链接(跨平台支持) bin-links=true # 更新通知关闭 update-notifier=false