首页 文章

聚合物 - 启动器套件初始化代理?

提问于
浏览
0

我正在尝试在Mac上完成Polymer tutorial . 但是,在尝试加载入门工具包时,我遇到以下错误:

?您想使用哪种入门模板? polymer-2-starter-kit info:运行模板polymer-2-starter-kit ... info:查找PolymerElements / polymer-starter-kit错误的最新^ 3.0.0版本:未捕获异常:getaddrinfo ENOTFOUND api.github.com api.github.com:443错误:错误:getaddrinfo ENOTFOUND api.github.com api.github.com:443 at __dirname.sendError(/ usr / local / lib / node_modules / polymer-cli / node_modules / github / lib / index .js:838:19)在/usr/local/lib/node_modules/polymer-cli/node_modules/github/lib/index.js:849:29 at callCallback(/ usr / local / lib / node_modules / polymer-cli /在ClientRequest上的node_modules / github / lib / index.js:713:17) . (/usr/local/lib/node_modules/polymer-cli/node_modules/github/lib/index.js:791:17)在ClientRene(events.js:96:13)的ClientRequest.emit(events.js:188: 7)在TLSSocket.socketErrorListener(_http_client.js:309:9)at emitOne(events.js:96:13)at TLSSocket.emit(events.js:188:7)at connectErrorNT(net.js:1021:8) 1147425-FVFTM15DH3QK:聚合物测试

我落后了.2823759_ . 但是,尝试通过明确声明代理(例如 https_proxy=http://proxy:port http_proxy=http://proxy:port polymer init polymer-2-starter-kit )来启动它会导致相同的结果 . 如何确保入门套件加载?谢谢!

2 回答

  • 0

    您需要设置代理

    对于GitHub,命令是

    git config --global http.proxy whatever-url
    
    git config --global https.proxy whaterver-url
    

    您甚至需要在节点级别执行这些操作,因为当它尝试执行npm安装时,它将需要这些 .

    命令是

    npm config set proxy whatever-url
    
    npm config set https-proxy whatever-url
    

    虽然入门套件试图进行bower安装,但它会失败,因为它落后于代理 .

    创建.bowerrc文件并在此处保留以下内容

    {
        "directory": "bower_components",
        "proxy": "whatever url",
        "https-proxy": "whatever url"
    }
    
  • 0

    相当旧的线程,但我刚遇到同样的问题 . 正是这个问题在ploymer-cli中得到修复here

    因此,如果您在Linux上运行以下设置http和https代理

    export HTTP_PROXY='http://<proxyhost>:<port>' 
    export HTTPS_PROXY='http://<proxyhost>:<port>'
    

    注意:请使用HTTP_PROXY而不是http_proxy(小写),因为上面提到的修复使用大写键 . 我浪费了一段时间,因为我使用小写设置代理

相关问题