Reputation: 121
I have configured artifactory and npm to work behind a proxy:
npm config set registry http://myserver:8081/artifactory/api/npm/npmjs
When I call npm info bower
it works fine but the tarball URL already looks suspicous: { tarball: 'http://myserver:8081/artifactory/api/npm/npmjs/registry.npmjs.org/bower/-/bower-1.3.12.tgz', shasum: '37de0edb3904baf90aee13384a1a379a05ee214c' }
npm install bower
fails because of the wrong tarball URL. This is the relavant output of my npm-debug.log:
34 silly mapToRegistry registry http://myserver:8081/artifactory/api/npm/npmjs
35 silly mapToRegistry uri http://myserver:8081/artifactory/api/npm/npmjs/bower
36 verbose addRemoteTarball http://myserver:8081/artifactory/api/npm/npmjs/registry.npmjs.org/bower/-/bower-1.3.12.tgz not in flight; adding
37 verbose addRemoteTarball [ 'http://myserver:8081/artifactory/api/npm/npmjs/registry.npmjs.org/bower/-/bower-1.3.12.tgz',
37 verbose addRemoteTarball '37de0edb3904baf90aee13384a1a379a05ee214c' ]
38 info retry fetch attempt 1 at 11:39:11
39 info attempt registry request try #1 at 11:39:11
40 http fetch GET http://myserver:8081/artifactory/api/npm/npmjs/registry.npmjs.org/bower/-/bower-1.3.12.tgz
41 http fetch 404 http://myserver:8081/artifactory/api/npm/npmjs/registry.npmjs.org/bower/-/bower-1.3.12.tgz
42 error fetch failed http://myserver:8081/artifactory/api/npm/npmjs/registry.npmjs.org/bower/-/bower-1.3.12.tgz
The part registry.npmjs.org
in the URL is wrong and the correct tarball URL should be this one: http://myserver:8081/artifactory/api/npm/npmjs/bower/-/bower-1.3.12.tgz
. From this URL I can downlaod the tarball manually using curl.
Any ideas if I have configured something wrong or if there is a bug somewhere?
Artifactory v3.4.2, npm v2.5.1
Upvotes: 3
Views: 5984
Reputation: 772
I have this issue when the package has a package-lock file with reference to npmjs.org. For example a file like this: https://github.com/mckn/gulp-nuget/blob/master/npm-shrinkwrap.json
I guess the only solution is using relative URLs in resolved field of the package-lock file.
Upvotes: 0
Reputation: 45
Your Artifactory front end displays the correct string for the npm config
Does this match what your running ?
Mine looks like this
#Add this registry URL to your ~/.npmrc or use:
npm config set registry http://serverName:8081/artifactory/api/npm/npmjs
I'm just wondering if the config of the remote repo is correct in Artifactory
Another option is to try zapping the cache on the npm remote repo
Is there any info in the Artifactory system logs showing what its trying to do?
Upvotes: 0
Reputation: 86
It can happen when the remote repository that should proxy the npmjs registry is pointing on the wrong URL (e.g. http://registry.npmjs.com instead of .org).
Upvotes: 1