Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Commit

Permalink
Use github releases to serve download files
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Santos committed Mar 25, 2016
1 parent 18bed40 commit 2da9622
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
3 changes: 2 additions & 1 deletion install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = ''

Expand Down

0 comments on commit 2da9622

Please sign in to comment.