"npm config set registry https://registry.npmjs.org/" is not working in windows bat file


I create a.bat on windows 7, the content of a.bat is:

@echo off
npm config set registry https://registry.npmjs.org/

and then run a.bat, but not working, I find the word "set" is special keyword for npm and bat, is there any methods to resolve this question?

This question is tagged with node.js batch-file npm

~ Asked on 2014-03-13 16:34:19

The Best Answer is


You shouldn't change the npm registry using .bat files. Instead try to use modify the .npmrc file which is the configuration for npm. The correct command for changing registry is

npm config set registry <registry url>

you can find more information with npm help config command, also check for privileges when and if you are running .bat files this way.

~ Answered on 2014-03-13 21:07:28


We can also run npm install with registry options for multiple custom registry URLs.

npm install --registry=https://registry.npmjs.org/ 
npm install --registry=https://custom.npm.registry.com/ 

~ Answered on 2017-05-09 00:27:00

Most Viewed Questions: