简体   繁体   English

如何在package.json文件中指定项目npm注册表

[英]How to specify project npm registry inside package.json file

I am working on multiple projects at the same time and the node module registry for different projects are not the same. 我正在同时处理多个项目,并且不同项目的节点模块注册表不一样。

For example, all modules for project A are from http://registroy.foo.com and modules for project B are all from http://registroy.bar.com 例如,项目A的所有模块都来自http://registroy.foo.com ,而项目B的模块都来自http://registroy.bar.com

Is there a way we can specify the registry we want to use for the project inside package.json file, something like source defined inside a Gemfile in Ruby. 有没有办法可以指定我们想要用于package.json文件中的项目的注册表,比如在Ruby中的Gemfile中定义的source

不,但您可以在项目的根目录中使用.npmrc文件来指定registry

registry=http://registroy.foo.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM