"npm配置设置注册表https://registry.npmjs.org/"在Windows bat文件中不起作用 [英] "npm config set registry https://registry.npmjs.org/" is not working in windows bat file
问题描述
我在Windows 7上创建a.bat,a.bat的内容是:
I create a.bat on windows 7, the content of a.bat is:
@echo off
npm config set registry https://registry.npmjs.org/
然后运行a.bat,但是没有用,我发现单词"set"是npm和bat的特殊关键字,有什么方法可以解决这个问题?
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?
推荐答案
您不应使用.bat
文件更改npm注册表.
而是尝试使用修改.npmrc
文件,该文件是npm
的配置.
更改注册表的正确命令是
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>
您可以使用npm help config
命令找到更多信息,还可以在以这种方式运行.bat
文件时以及是否以这种方式运行时检查特权.
you can find more information with npm help config
command, also check for privileges when and if you are running .bat
files this way.
这篇关于"npm配置设置注册表https://registry.npmjs.org/"在Windows bat文件中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!