You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用代理执行npm install报错求助,附相关配置及日志

Troubleshooting npm Install Failure in Proxy Environment

Hey there, let's work through this npm install issue you're hitting. Based on what you've shared and the error snippet mentioning Git commands failing, here are targeted fixes to try:

1. Configure Git Proxy Settings

Since npm relies on Git to fetch certain dependencies, your Git client might not be configured to use the proxy yet (even if npm is). Run these commands in your Git bash:

  • Set basic proxy for HTTP/HTTPS:
    git config --global http.proxy http://your-proxy-host:port
    git config --global https.proxy https://your-proxy-host:port
    
  • If your proxy requires authentication, use this format (replace placeholders with your actual credentials):
    git config --global http.proxy http://your-username:your-password@your-proxy-host:port
    git config --global https.proxy https://your-username:your-password@your-proxy-host:port
    
  • Verify the configuration with:
    git config --global --list
    

2. Validate Your .npmrc Configuration

Double-check the .npmrc file in C:\Users\user to ensure proxy and registry settings are correct. It should look something like this (adjust values to match your environment):

proxy=http://your-proxy-host:port
https-proxy=http://your-proxy-host:port
registry=https://registry.npmmirror.com/
strict-ssl=false  # Add this if you're using a self-signed proxy certificate

3. Enable Git Long Paths

Your error log mentions core.longpaths=true, which suggests Windows' default path length limit might be causing issues. Enable long path support in Git:

git config --global core.longpaths true

4. Clean Cache and Retry

Corrupted npm cache can sometimes cause installation failures. Clear it and try again:

npm cache clean --force
npm install

5. Upgrade Git Version

Your Git version (2.17.0.windows.1) is quite outdated and might have compatibility issues with newer npm versions. Consider upgrading to the latest stable Git release for Windows, then re-run the installation.

Your Original Error Log:

user@trsrall2060597 MINGW64 /c/xyzsite/trs-b2b-ui (develop) $ npm install npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --...

内容的提问来源于stack exchange,提问作者Yespie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 04:12:38