"npm配置设置注册表https://registry.npmjs.org/"在Windows bat文件中不起作用 [英] "npm config set registry https://registry.npmjs.org/" is not working in windows bat file

查看:724
本文介绍了"npm配置设置注册表https://registry.npmjs.org/"在Windows bat文件中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆