diff --git a/README.md b/README.md index 7421a9e6d..312e9fe73 100644 --- a/README.md +++ b/README.md @@ -71,28 +71,30 @@ the request of PhantomJS team. Deciding Where To Get PhantomJS ------------------------------- -By default, this package will download phantomjs from `https://bitbucket.org/ariya/phantomjs/downloads`. +By default, this package will download phantomjs from our [releases](https://github.com/Medium/phantomjs/releases/). This should work fine for most people. ##### Downloading from a custom URL -If bitbucket is down, or the Great Firewall is blocking bitbucket, you may need to use -a download mirror. To set a mirror, set npm config property `phantomjs_cdnurl`. -Default is ``. +If github is down, or the Great Firewall is blocking github, you may need to use +a different download mirror. To set a mirror, set npm config property `phantomjs_cdnurl`. -```shell -npm install phantomjs-prebuilt --phantomjs_cdnurl=http://cnpmjs.org/downloads +Alternatives include `https://bitbucket.org/ariya/phantomjs/downloads` (the official download site) +and `http://cnpmjs.org/downloads`. + +```Shell +npm install phantomjs-prebuilt --phantomjs_cdnurl=https://bitbucket.org/ariya/phantomjs/downloads ``` Or add property into your `.npmrc` file (https://www.npmjs.org/doc/files/npmrc.html) ``` -phantomjs_cdnurl=http://cnpmjs.org/downloads +phantomjs_cdnurl=https://bitbucket.org/ariya/phantomjs/downloads ``` Another option is to use PATH variable `PHANTOMJS_CDNURL`. ```shell -PHANTOMJS_CDNURL=http://cnpmjs.org/downloads npm install phantomjs +PHANTOMJS_CDNURL=https://bitbucket.org/ariya/phantomjs/downloads npm install phantomjs ``` ##### Using PhantomJS from disk @@ -175,9 +177,9 @@ was not able to download the PhantomJS binary for your platform. Please try agai ##### I tried again, but I get `ECONNRESET` or `ETIMEDOUT` consistently. Do you live in China, or a country with an authoritarian government? We've seen problems where -the GFW or local ISP blocks bitbucket, preventing the installer from downloading the binary. +the GFW or local ISP blocks github, preventing the installer from downloading the binary. -Try visiting [the download page](http://cdn.bitbucket.org/ariya/phantomjs/downloads) manually. +Try visiting [the download page](https://bitbucket.org/ariya/phantomjs/downloads) manually. If that page is blocked, you can try using a different CDN with the `PHANTOMJS_CDNURL` env variable described above. diff --git a/install.js b/install.js index 0e93a3d41..58dc7f67d 100644 --- a/install.js +++ b/install.js @@ -20,6 +20,7 @@ var url = require('url') var which = require('which') var originalPath = process.env.PATH +var DEFAULT_CDN = 'https://github.com/Medium/phantomjs/releases/download/v2.1.1/' // If the process exits without going through exit(), then we did not complete. var validExit = false @@ -428,7 +429,7 @@ function getDownloadUrl() { function getDownloadSpec() { var cdnUrl = process.env.npm_config_phantomjs_cdnurl || process.env.PHANTOMJS_CDNURL || - 'https://bitbucket.org/ariya/phantomjs/downloads' + DEFAULT_CDN var downloadUrl = cdnUrl + '/phantomjs-' + helper.version + '-' var checksum = ''