Mirror NPM download site

528 views
Skip to first unread message

Anthony Dahanne

unread,
May 16, 2016, 10:35:33 PM5/16/16
to nexus...@glists.sonatype.com
Hello Nexus users,
I could configure with success a NPM proxy to the npm registry and a NPM group.
I also could update my .npmrc to point to my nexus NPM group repo - thanks ot the info provided in


But I found out that for the phantomjs package, only a wrapper is downloaded from the global npm registry; and then this wrapper downloads an additional package  from https://bitbucket.org/ariya/phantomjs/downloads :


> node install.js

Saving to /var/folders/sb/0dkmbsl97sbf6pdmbbwmtv6x5c1p_j/T/phantomjs/phantomjs-1.9.7-macosx.zip


I would like Nexus to mirror this download site; I would then configure the phantom wrapper to use this self hosted mirror (using in .npmrc phantomjs_cdnurl=https://mynexusurl:8081/phantomjs/downloads as explained in https://github.com/Medium/phantomjs/blob/master/README.md)

Is there a way to ask Nexus to regularly mirror a plain download site ?

Thank you for your answers !

Rich Seddon

unread,
May 17, 2016, 10:22:58 AM5/17/16
to Anthony Dahanne, nexus...@glists.sonatype.com
There isn't any way to do this using Nexus 2.  In Nexus 3 you could try using a raw proxy repository, this might work.




--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/CAJHJdS9Lg29ZLrGV2%3DRL9tvhDLTGy8hdYohYznQnDj%2Boq%3DMSAg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Anthony Dahanne

unread,
May 17, 2016, 12:16:21 PM5/17/16
to Nexus Users, anthony...@gmail.com
Hello Rich, Jacob,
Right, I'm still stuck with Nexus 2.11 - and thanks for the pointer to the issue, feels good to know I'm not the only one bothered by NPM design...
Anyway, here's what I did to solve the issue :
* downloaded all the archives from https://bitbucket.org/ariya/phantomjs/downloads/ using my browser and a download them all extension
* compressed them into 1 single zip
* push the zip to nexus using curl : curl --upload-file phantomjs.zip -u user:password -v http://nexus.corp/service/local/repositories/thirdparty/content-compressed/phantomjs/
* updated my npm invokation in jenkins with : PHANTOMJS_CDNURL=http://nexus.corp/content/repositories/thirdparty/phantomjs/phantomjs.zip/phantomjs/ npm install


I could automate all that , but.. I guess I'll upgrade to Nexus 3 sometimes !

Thanks
Anthony

morten bjoernsvik

unread,
Oct 3, 2016, 6:47:12 AM10/3/16
to Nexus Users, anthony...@gmail.com
Hi

I tried adding a raw proxy for https://github.com in nexus3 and added it to our group, but it just ignores it:

> phan...@2.1.7 install /testphantomjs/node_modules/phantomjs
> node install.js

PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1//phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /testphantomjs/node_modules/phantomjs/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...

Received 22866K total.

My github.com-npm proxy is empty, any ideas, add a local node_module just for this?

Very easy to test with Docker, create your nexus3 group consisting of a npm local for local files, and add a https://npmjs.org and  https://github.com proxies

$ cat Dockerfile
FROM mhart/alpine-node:6.7.0
RUN mkdir /testphantomjs && cd /testphantomjs && npm config set registry "https://nexus3repo:8443/repository/bp-npm/" && npm init -q -y && npm install phantomjs --save

$ docker build -t phantomjs-test .

After finishing building:
Nothing in your github proxy, while your nodejs.org proxy has a lot.

--
MortenB

Peter Lynch

unread,
Oct 3, 2016, 8:12:27 AM10/3/16
to morten bjoernsvik, Nexus Users, anthony...@gmail.com
Nexus can't talk to a remote git repo using the git protocol, not even using an npm proxy repository. A raw proxy repository can only send basic HTTP requests to the remote, using the same path as requested into nexus with.

On Mon, Oct 3, 2016 at 7:47 AM, morten bjoernsvik <morten.b...@gmail.com> wrote:
Hi

I tried adding a raw proxy for https://github.com in nexus3 and added it to our group, but it just ignores it:

> phan...@2.1.7 install /testphantomjs/node_modules/phantomjs
> node install.js

PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1//phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /testphantomjs/node_modules/phantomjs/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...

Received 22866K total.

My github.com-npm proxy is empty, any ideas, add a local node_module just for this?

Very easy to test with Docker, create your nexus3 group consisting of a npm local for local files, and add a https://npmjs.org and  https://github.com proxies

$ cat Dockerfile
FROM mhart/alpine-node:6.7.0
RUN mkdir /testphantomjs && cd /testphantomjs && npm config set registry "https://nexus3repo:8443/repository/bp-npm/" && npm init -q -y && npm install phantomjs --save


What type of format is the bp-npm proxy repository? Is it RAW proxy? 

When you use npm `config set registry` to set a registry location, then that repository format must be npm *when talking to nexus*.

The way to override what URL phantomjs uses to download releases, is described here: https://www.npmjs.com/package/phantomjs#downloading-from-a-custom-url

 
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

To post to this group, send email to nexus...@glists.sonatype.com.
Reply all
Reply to author
Forward
0 new messages