“npmconfiguration设置registryhttps://registry.npmjs.org/”不在Windows bat文件中工作
我在windows 7上创builda.bat,a.bat的内容是:
@echo off npm config set registry https://registry.npmjs.org/ 然后运行a.bat,但不工作,我发现“set”这个词是npm和bat的特殊关键字,是否有任何方法可以解决这个问题?
 您不应该使用.bat文件更改npmregistry。 而是尝试使用修改npmconfiguration的.npmrc文件。 用于更改registry的正确命令是 
 npm config set registry <registry url> 
 你可以通过npm help config命令find更多的信息,也可以通过这种方式检查是否有权限运行.bat文件。 
您可以使用.bat进行更改,请确保先运行呼叫命令,希望这有助于将来任何人制作类似的.bat命令
 call npm config set registry https://registry.npmjs.org/ 
 我们也可以为多个自定义registryURL运行npm install和registry选项。 
 npm install --registry=https://registry.npmjs.org/ npm install --registry=https://custom.npm.registry.com/ 
在版本4.4.1上,您可以使用:
 npm config set @myco:registry http://reg.example.com 
@myco是你的软件包范围。 你可以这样安装包:
 npm install @myco/my-package 
ref: https : //docs.npmjs.com/misc/scope
在npm版本3.7.3上
 npm set registry=http://whatever/ 
也许我太迟回答了。 但是,如果有人需要它,下面的工作很好,因为我已经使用了很多次。
 npm config set registry=https://registry.npmjs.com/ 
 通过执行你的.bat你只设置configuration会议不全球。 当你打开另一个cmd提示符并运行npm install ,那个configuration文件将不会为这个会话设置,所以把你的.bat文件修改为 
 @echo off npm config set registry https://registry.npmjs.org/ @cmd.exe /K