13
votes

So basically I am trying to download packages from https://registry.npmjs.org/ using npm install, but I am under a proxy.

I have set-up a remote repository that will hit (above link) and cache using artifactory, so that I can pull locally, but it does not seem to work.

Followed these directions: http://www.jfrog.com/confluence/display/RTF/Npm+Repositories

Anyone else experience difficulties with proxy? I have seen many posts on changing config settings, but this is not what I need, I have to follow artifactory to get what I need, and I have changed my config settings accordingly to how artifactory advises, ie npm config set registry

Thanks!

3
Can you post the error you are getting from the npm client? did you make sure that "enable npm support" is checked? what is the registry URL you have configured?Dror Bereznitsky
Registry url is registry.npmjs.org and yes npm support is enabled.Jeremy
Error is: for instance I try to install bower, using npm install -g bower. This provides me with a 404 not found: artifactory. Then says, 'artifactory' is not in the npm registry.Jeremy
I meant the Artifactory registry URL, should be something like localhost:8081/artifactory/api/npm/myrepoDror Bereznitsky
yeah the url is basically that, just company info with it. But at this point I think we are trying a different workaround.Jeremy

3 Answers

13
votes

The error message indicated that npm tried looking for a package named 'artifactory' instead of 'bower' :

'artifactory' is not in the npm registry

This can happen due to various misconfiguration:

  1. Configuring the Artifactory repository to use a wrong registry URL like https://registry.npmjs.org/artifactory
  2. Configuring npm to use a wrong registry URL: npm config set registry http://myserver:8081/artifactory/api/npm/npmjs-registry/artifactory

Both cases will cause Artifactory to send requests to the public registry with the following URL: https://registry.npmjs.org/artifactory/bower instead of https://registry.npmjs.org/bower

In order to make sure your setup is correct, try the following:

  1. Click the "Test" button in the Artifactory "Edit Remote Repository" window to verify that the registry URL is correct and Artifactory can reach it
  2. Verify the registry URL stored in the .npmrc configuration file. For example, you can send a request for getting the 'bower' package info: curl -vv http://myserver:8081/artifactory/api/npm/npm-repo-name/bower

  3. If npm install still fails, look at the npm-debug.log and the Artifactory log files for more info

2
votes

Along with above answer,Please ensure that following option has been added to properties file.

$ARTIFACTORY_HOME/tomcat/conf/catalina.properties file (for Artifactory 4.x) or %ARTIFACTORY_HOME%\etc\artifactory.system.properties for Artifactory 3.x.

org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true

1
votes

Try removing proxy and https_proxy from .npmrc and configure the Proxy settings in Artifactory