bitbucket rate limiting phantomjs

2019-07-29 14:41发布

问题:

My CI builds keep failing with:

> 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.

This appears to be due to rate limiting on bitbucket.org. How can I prevent these errors?

回答1:

Simply export a link to a different binary location, e.g. export PHANTOMJS_CDNURL=http://cnpmjs.org/downloads

For example, if you are using TravisCI you can use:

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

In CircleCI, you can use the following:

machine:

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