在使用git remote url进行npm安装时如何指定注册表? [英] How to specify registry while doing npm install with git remote url?

查看:85
本文介绍了在使用git remote url进行npm安装时如何指定注册表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够使用此处 指定的URL克隆git存储库. >

I want to be able to clone a git repository using a URL as specified here

<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish>]

我说错了

npm ERR! 404注册表在GET上返回404 https://registry.npmjs.org/XYZ

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/XYZ

所以我还应该能够在执行操作时指定注册表,因为应该从内部存储库中提取模块.

So I should also be able to specify the registry while doing since modules are supposed to be picked up from a internal repository.

使用 git remote url 进行 npm安装时是否可以指定注册表?

推荐答案

npm从命令行,环境变量和npmrc文件获取其配置设置.您可以尝试在npmrc文件中指定注册表,并在命令行中指定模块. 要更改注册表,可以使用命令:

npm gets its config settings from the command line, environment variables, and npmrc files. You can try to specify registry in a npmrc file, and module in the command line. To change registry, you can use command:

npm config set registry <registry url>

您还可以在--参数的帮助下更改配置.在命令行上输入--foo bar会将foo配置参数设置为" bar ".因此,您可以尝试执行以下操作:

You can also change configs with the help of -- argument. Putting --foo bar on the command line sets the foo configuration parameter to "bar". So you can try something like that:

 npm install http://git.repo.url --registry=https://your.registry.local/

这篇关于在使用git remote url进行npm安装时如何指定注册表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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