位桶限速 phantomjs

bitbucket rate limiting phantomjs

我的 CI 构建不断失败:

> phantomjs@1.9.7-15 install /home/travis/build/redgeoff/paste-image/node_modules/mocha-phantomjs/node_modules/phantomjs
> node install.js
PhantomJS detected, but wrong version 1.9.8 @ /usr/local/phantomjs/bin/phantomjs.
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-1.9.7-linux-x86_64.tar.bz2
Receiving...

Error requesting archive.
Status: 403
Request options: {
  "uri": "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2",
  "encoding": null,
  "followRedirect": true,
  "headers": {},
  "strictSSL": true
}
Response headers: {
  "x-amz-request-id": "31FE6AEAF3807721",
  "x-amz-id-2": "ePama6pBgS1VdgDLGaFpUxLSmqkm0KJ/mflR8jUU28aPteacBzcKHeoQf18F+Sz7KKrn5UzGMVE=",
  "content-type": "application/xml",
  "transfer-encoding": "chunked",
  "date": "Fri, 16 Sep 2016 06:56:57 GMT",
  "server": "AmazonS3"
}
Make sure your network and proxy settings are correct.

这似乎是由于 bitbucket.org 的速率限制。我怎样才能避免这些错误?

只需将 link 导出到不同的二进制位置,例如export PHANTOMJS_CDNURL=http://cnpmjs.org/downloads

例如,如果您使用的是 TravisCI,则可以使用:

  global:
    - PHANTOMJS_CDNURL=http://cnpmjs.org/downloads

在 CircleCI 中,您可以使用以下内容:

machine:

  environment:
    # Use a CDN to prevent bitbucket rate limits when downloading phantomjs
    PHANTOMJS_CDNURL: http://cnpmjs.org/downloads