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

安装Stencil CLI/Framework报错:无法连接github.com

Fixing npm WARN addRemoteGit Error When Installing Stencil CLI on Windows

It sounds like npm is hitting a snag when trying to interact with Git during the Stencil CLI installation—this is usually tied to Git configuration or proxy quirks on Windows. Let’s walk through targeted fixes to get this sorted:

1. Enable Git's Long Paths Globally

Windows has a default limit on file path lengths, which can break Git operations during package installs. The error mentions core.longpaths=true, so let’s set this globally to avoid per-command issues:

git config --global core.longpaths true

After running this, retry the install command:

npm install -g @bigcommerce/stencil-cli

2. Double-Check Git's Proxy Configuration

Even if you’ve set up npm’s proxy, Git needs its own proxy settings to access remote repositories. In Git Bash, configure your proxy for both HTTP and HTTPS:

# Replace <proxy-url:port> with your actual proxy details
git config --global http.proxy http://<proxy-url:port>
git config --global https.proxy https://<proxy-url:port>

If your proxy requires authentication, include your credentials:

git config --global http.proxy http://<username>:<password>@<proxy-url:port>
git config --global https.proxy https://<username>:<password>@<proxy-url:port>

Verify your settings with:

git config --global --get http.proxy
git config --global --get https.proxy

3. Clear npm's Cache

Corrupted cached data can sometimes cause unexpected errors. Clear the npm cache and try the install again:

npm cache clean --force
npm install -g @bigcommerce/stencil-cli

4. Run Git Bash as Administrator

Windows permission restrictions might block Git from accessing certain configuration files. Right-click Git Bash and select "Run as administrator", then execute the install command again.

5. Verify Git is in Your System PATH

Ensure Git’s executable directory is added to your system PATH so npm can call it correctly:

  • Open System Properties > Advanced > Environment Variables
  • Under "System Variables", find the PATH entry and check if it includes C:\Program Files\Git\bin (or your Git installation directory)
  • If not, add it, restart your terminal, and retry the install.

6. Test Without Proxy (If Possible)

If you have access to a network without a proxy, try installing Stencil CLI there. This will help confirm if the proxy is the root cause of the issue.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 09:47:13