在package.json中定义私有注册表 [英] Define private registry in package.json

查看:159
本文介绍了在package.json中定义私有注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个基于 Sinopia

我应该在package.json中定义什么是从Synopia而不是从全局npm存储库安装某些软件包?

What should I define in package.json that some packages will be installed from Synopia rather then from global npm repository?

如果从命令行安装它,则可以运行:npm install <package_name> --registry <http://<server:port>

If I install it from command line I can run: npm install <package_name> --registry <http://<server:port>

P.S.试图谷歌搜索NPM官方文档,但未找到任何内容.

P.S. tried to google and looked in official NPM documentation but have found nothing.

推荐答案

我知道的一种方法是.npmrc 您也可以在项目内使用.npmrc

One of the method i know that is by .npmrc You can also use .npmrc also inside the project

像这样设置配置

registry = http://10.197.142.28:8081/repository/npm-internal/
init.author.name = Himanshu sharma
init.author.email = rmail@email.com
init.author.url = http://blog.example.com
# an email is required to publish npm packages
email=youremail@email.com
always-auth=true
_auth=YWRtaW46YWRtaW4xMjM=

auth可以通过以下方式生成 用户名密码 echo -n'admin:admin123'| openssl base64

auth can be generate by username:password echo -n 'admin:admin123' | openssl base64

输出YWRtaW46YWRtaW4xMjM =

output YWRtaW46YWRtaW4xMjM=

这篇关于在package.json中定义私有注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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