How to install phantomjs-prebuilt?

Phantomjs-prebuilt package is sometimes referenced as part of post-install script that Artifactory's npm external dependency rewrite function cannot catch. 

When your npm client does not have access to github.com, then your installation (with debug  --dd) may fail with the following logs:

> phantomjs-prebuilt@2.1.9 install X:node_modulesphantomjs-prebuilt

> node install.js

PhantomJS not found on PATH

Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantom

js-2.1.1-windows.zip

Saving to C:Usersc38632AppDataLocalTempphantomjsphantomjs-2.1.1-windows.z

ip

Receiving...

Error making request.

Error: connect ETIMEDOUT 192.30.253.112:443

    at Object.exports._errnoException (util.js:860:11)

    at exports._exceptionWithHostPort (util.js:883:20)

    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)

If you would like to block your client machine from directly accessing github to download the file, then you may use following steps:

1. Manually download files from https://bitbucket.org/ariya/phantomjs/downloads to a local disk

2. Create a new GENERIC repository in Artifactory and upload the files downloaded above. (You will not be able to make the URL above as a remote repository, because the remote URL is blocking HEAD request. See https://www.jfrog.com/jira/browse/RTFACT-11923 for more details about this limitation)

3. Add property into your .npmrc file (https://www.npmjs.org/doc/files/npmrc.html)

phantomjs_cdnurl=https://MY_ARTIFACTORY/artifactory/my-generic-repo-phantomjs/folder

For more information, visit

https://www.npmjs.com/package/phantomjs-prebuilt#downloading-from-a-custom-url