npm - Unable to install private library via virtual repo url

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

npm - Unable to install private library via virtual repo url

Vasu Srinivasan
Hello

Im trying out Artifactory Enterprise 4.1.2 rev 40017. Im having issues in installing a published private npm library via a virtual repo url.

Here is my setup:

1. I have a local (private) repo - my-local-repo and a remote repo pointing to http://registry.npmjs.org (npm-public)
2. I have a virtual repo npm-virtual (which contains both private and publich repositories)
3. I published $my-lib using npm publish --registry /api/npm/my-local-repo
4. I see the library in /artifactory/npm-virtual/my-lib/~/my-lib-0.0.1.tgz
5. I also see the json in /artifactory/api/npm/my-local-repo/my-lib

Issue #1:
1. My npmrc points to /artifactory/npm-virtual
2. My application references my-lib in package.json
3. When I do npm install within my application, I get 406 error:

npm ERR! code E406

npm ERR! Registry returned 406 for GET on /artifactory/npm-virtual/my-lib

So I changed my npmrc to point to my-local-repo:

Issue #2:
1. My npmrc points to /artifactory/api/npm/my-local-repo
2. Now I can install my-lib, but my application wont install any other public libs like lodash etc. (I get 404)

What am I missing ?

Any pointeres appreciated . Thanks in Advanced!






Reply | Threaded
Open this post in threaded view
|

Re: npm - Unable to install private library via virtual repo url

Vasu Srinivasan
I upgraded to Artifactory 4.2.2 and I am able to publish to npm-virtual.

But after publishing I am unable to "npm install" the package back again.

Browsing my /artifactory/npm-virtual has the public npm repositores in the form of a json file (which is same name as the npm package) and a .md5 and .sha1.

For eg, abbrev (which is a json file), abbrev.md5 and abbrev.sha1


But my-lib does not have such a json file entry.

Instead it has a my-lib directory, within which ~/my-lib.tgz, .md5 and .sha1 are present.

When I do npm install my-lib from my terminal, it appears to look for a json file with my-lib name which is not being found. So it returns 406.


How do I publish correctly to a virtual repository so that my-lib appears in the npm-virtual ?




Reply | Threaded
Open this post in threaded view
|

Re: npm - Unable to install private library via virtual repo url

Vasu Srinivasan
If it helps any further, here is the output from "npm install my-lib --verbose"

The first request is to fetching a file called my-lib (type json) which fails.

cache add spec my-lib
npm verb addNamed "*" is a valid semver range for my-lib
npm verb addNameRange registry:http://artifactory-server:8081/artifactory/npm-virtual/my-lib not in flight; fetching
npm verb request uri http://artifactory-server:8081/artifactory/npm-virtual/my-lib
npm verb request always-auth set; sending authorization
npm info attempt registry request try #1 at 08:43:24
npm verb request id 71ab0bcc8ca8976e
npm http request GET http://artifactory-server:8081/artifactory/npm-virtual/my-lib
npm http 406 http://artifactory-server:8081/artifactory/npm-virtual/my-lib
npm verb headers { server: 'Artifactory/4.2.2',
npm verb headers   'x-artifactory-id': 'b4fe49f5ba1b975e:2508873e:1510313266e:-8000',
npm verb headers   'artifactory-ui-messages': '[]',
npm verb headers   'content-type': 'application/json',
npm verb headers   'transfer-encoding': 'chunked',
npm verb headers   date: 'Sun, 15 Nov 2015 14:43:24 GMT',
npm verb headers   connection: 'close' }
npm verb stack Error: Registry returned 406 for GET on http://artifactory-server:8081/artifactory/npm-virtual/my-lib
npm verb stack     at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:239:14)
npm verb stack     at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:170:14)
npm verb stack     at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:354:22)
npm verb stack     at Request.emit (events.js:110:17)
npm verb stack     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1207:14)
npm verb stack     at Request.emit (events.js:129:20)
npm verb stack     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1153:12)
npm verb stack     at IncomingMessage.emit (events.js:129:20)
npm verb stack     at _stream_readable.js:908:16
npm verb stack     at process._tickCallback (node.js:355:11)
npm verb statusCode 406
npm verb pkgid my-lib