KingFish
KingFish

Reputation: 9153

Installing Package Using NPM from Private Repository

What is the correct syntax in "package.json" so I can install a package from a private npm repository.

My repository is running sinopia at http://localhost:4873 and I have a package called "foo". I can upload without issue

I want something like this in my package.json file:

{
  "name": "y",
  ...
  "dependencies": {
      "foo": "http://localhost:4873/"
  },
}

Thanks

Upvotes: 5

Views: 6613

Answers (2)

Pierre Inglebert
Pierre Inglebert

Reputation: 3930

You can also set it in your project if you create a .npmrc file with registry=http://your_registry in your project from where you do your npm install

Upvotes: 2

KingFish
KingFish

Reputation: 9153

So it turns out I am not able to do this by way of package.json. The most I can do is preregister the server:

 npm set registry <server>

Then npm will find my packages as necessary

Upvotes: 0

Related Questions