3

I am using gradle with gradle-node-plugin. The problem is that I don't have access to public registers so node cannot download anything from https://registry.npmjs.org/. I need to use nexus as proxy butt don't know how to change url to which npm is pointing. Does anyone know the solution?

Shorn
  • 19,077
  • 15
  • 90
  • 168
user3450486
  • 215
  • 4
  • 16

2 Answers2

3

I believe the Gradle Node Plugin executes npm itself to resolve modules so just updating your .npmrc with registry=https://npm.yourcompany.com ought to work.

Note that this is basically what npm config set registry does, as RaGe suggested in his comment.

Eric Wendelin
  • 43,147
  • 9
  • 68
  • 92
0

If you want to do this directly in a gradle task you can use the following:

task setregistry(type: NpmTask) {
  args = ['config', 'set', 'registry', 'https://npm.registry.company.com']
}

You can also do this if you want to set the registry for a specific scope:

task setregistry(type: NpmTask) {
  args = ['config', 'set', '@scope:registry', 'https://npm.registry.company.com']
}
MGothe
  • 11
  • 3