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

Jenkins中执行bower install失败,报ENOTFOUND错误求助

Troubleshooting bower install ENOTFOUND Error in Jenkins

Hey there, let's figure out why your bower install is throwing an ENOTFOUND error in Jenkins. This error almost always points to network connectivity issues or problems with how Bower is configured to access package registries. Here's a step-by-step troubleshooting guide to get you sorted:

  • Check Jenkins server's network connectivity
    First, rule out basic network issues. Log into the Jenkins server and run these commands to test access to Bower's default registry:

    • Ping the registry: ping bower.herokuapp.com
    • Test HTTPS access: curl https://bower.herokuapp.com
      If either of these fails, your Jenkins server likely has a firewall block, missing proxy configuration, or no external network access. Work with your infrastructure team to confirm the server can reach external HTTPS endpoints.
  • Configure Bower proxy settings (if using a corporate proxy)
    If your Jenkins environment sits behind a corporate proxy, Bower won't auto-detect it by default. You have two options:

    1. Set proxy environment variables in Jenkins' build configuration:
      • Add HTTP_PROXY=http://your-proxy-host:port
      • Add HTTPS_PROXY=http://your-proxy-host:port
        (Include credentials if required: http://username:password@proxy-host:port)
    2. Add a .bowerrc file to your project root with proxy details:
      {
        "proxy": "http://your-proxy-host:port",
        "https-proxy": "http://your-proxy-host:port",
        "strict-ssl": false // Only use this if your proxy uses a self-signed cert
      }
      
  • Validate individual package accessibility
    ENOTFOUND might also stem from a specific package's registry entry being unreachable. Test installing dependencies one by one on the Jenkins server to isolate the problematic package:

    bower install angular#1.5.8
    bower install bootstrap#3.3.7
    # Repeat for other dependencies in your bower.json
    

    If a single package fails, you can override its source in bower.json by pointing directly to its Git repo. For example:

    "dependencies": {
      "angular": "git://github.com/angular/angular.js.git#1.5.8"
    }
    
  • Clear Bower cache and check directory permissions
    Corrupted cache or permission issues can sometimes mimic network errors. Try these steps:

    • Clear Bower's local cache: bower cache clean
    • Ensure the Jenkins user has read/write permissions for your project's working directory and Bower's cache directory (usually ~/.cache/bower).
  • Switch to a Bower registry mirror
    If the default Bower registry (bower.herokuapp.com) is unstable in your network, try using a mirror. Add this to your .bowerrc:

    {
      "registry": "https://registry.npm.taobao.org/bower"
    }
    

    Or run the install command with the mirror temporarily:

    bower install --registry=https://registry.npm.taobao.org/bower
    

Start with the network connectivity checks—they're the most common fix for ENOTFOUND errors. Let me know if any of these steps get you past the issue!

内容的提问来源于stack exchange,提问作者VIGNESH.SRINIVASAGAN

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 08:03:34