javascriptnode.jsnpmnpm-registry

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

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.


Solution

  • No, but you can use an .npmrc file in the root directory of your project to specify the registry.

    registry=http://registroy.foo.com