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

mopduan picture mopduan · Mar 13, 2014 · Viewed 373.7k times · Source

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?

Answer

Gntem picture Gntem · Mar 13, 2014

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.