如何在使用 git 远程 url 进行 npm 安装时指定注册表?
How to specify registry while doing npm install with git remote url?
我希望能够使用指定的 URL 克隆 git 存储库 here
<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish>]
我收到一条错误消息
npm ERR! 404 Registry returned 404 for GET on
https://registry.npmjs.org/XYZ
所以我也应该能够在执行时指定注册表,因为模块应该从内部存储库中获取。
在使用 git 远程 [=33] 进行 npm install 时是否可以 指定注册表 =]?
npm
从命令行、环境变量和 npmrc 文件获取其配置设置。您可以尝试在 npmrc 文件中指定注册表,并在命令行中指定模块。
要更改注册表,您可以使用命令:
npm config set registry <registry url>
您还可以在 --
参数的帮助下更改配置。在命令行中输入 --foo bar
会将 foo 配置参数设置为“bar”。所以你可以尝试这样的事情:
npm install http://git.repo.url --registry=https://your.registry.local/
不是最好的方法,但如果您使用 mac 或 linux,即使在您可以为不同的注册表设置别名。
##############NPM ALIASES######################
alias npm-default='npm config set registry https://registry.npmjs.org'
alias npm-sinopia='npm config set registry http://localhost:4873/'
是的,您需要使用:
npm config set registry <registry url>.
确保从公司内部的注册表安装包。
如果你正在做npm -i -g
,这是全局安装。
你需要做的:
npm -g config set registry <registry url>
我希望能够使用指定的 URL 克隆 git 存储库 here
<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish>]
我收到一条错误消息
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/XYZ
所以我也应该能够在执行时指定注册表,因为模块应该从内部存储库中获取。
在使用 git 远程 [=33] 进行 npm install 时是否可以 指定注册表 =]?
npm
从命令行、环境变量和 npmrc 文件获取其配置设置。您可以尝试在 npmrc 文件中指定注册表,并在命令行中指定模块。
要更改注册表,您可以使用命令:
npm config set registry <registry url>
您还可以在 --
参数的帮助下更改配置。在命令行中输入 --foo bar
会将 foo 配置参数设置为“bar”。所以你可以尝试这样的事情:
npm install http://git.repo.url --registry=https://your.registry.local/
不是最好的方法,但如果您使用 mac 或 linux,即使在您可以为不同的注册表设置别名。
##############NPM ALIASES######################
alias npm-default='npm config set registry https://registry.npmjs.org'
alias npm-sinopia='npm config set registry http://localhost:4873/'
是的,您需要使用:
npm config set registry <registry url>.
确保从公司内部的注册表安装包。
如果你正在做npm -i -g
,这是全局安装。
你需要做的:
npm -g config set registry <registry url>