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

How to specify project npm registry inside package.json file

我同时在做多个项目,不同项目的节点模块注册表不一样。

例如,项目 A 的所有模块都来自 http://registroy.foo.com,项目 B 的所有模块都来自 http://registroy.bar.com

有没有一种方法可以在 package.json 文件中指定要用于项目的注册表,例如 Ruby.[=15 中的 Gemfile 中定义的 source =]

不,但您可以使用 .npmrc file in the root directory of your project to specify the registry

registry=http://registroy.foo.com