gradle-node-plugin icon indicating copy to clipboard operation
gradle-node-plugin copied to clipboard

Please provide examples on how to provide configuration properties

Open eximius313 opened this issue 7 years ago • 5 comments

I'd like to provide configuration to properties. Invoking this from the commmand line works fine: npm config set registry https://registry.npmjs.org npm config set strict-ssl false

When I try to provide it in npm_task:

task setRegistry(type: NpmTask) {
  //Set NPM Registry
  args = ['config', 'set', 'registry', 'https://registry.npmjs.org']
}

I get following error:

Specify configs in the ini-formatted file:
    /user/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

so it is possible to pass values in npm <command> --key value fashion, but neither args = ['config', 'set', '--registry', 'https://registry.npmjs.org'] nor args = ['config', 'set', '--registry https://registry.npmjs.org'] works.

Could you please provide information in documentation on how to do it correctly?

eximius313 avatar Feb 02 '18 11:02 eximius313

Facing same problem, curious if anyone has found a way to do this?

jgriff avatar Oct 10 '18 21:10 jgriff

@jgriff use .npmrc files instead: https://docs.npmjs.com/files/npmrc

web-devel avatar Oct 18 '18 08:10 web-devel

@web-devel so every developer in project must create this file?

eximius313 avatar Oct 19 '18 12:10 eximius313

@eximius313 you can place .npmrc in the root of your project and commit it (obviously you should not commit any auth info)

web-devel avatar Oct 19 '18 15:10 web-devel

I too am looking for a way to set the npm registry, but creating a .npmrc file doesn't make sense in my case. I am not creating my own Node project, I'm just using npm to download scripts/tools that I use during my build for validation purposes. I don't have anywhere to put a .npmrc file.

So how else can this be accomplished?

john3300 avatar Oct 31 '18 20:10 john3300