Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define private registry in package.json

We have a private npm repository based on Sinopia

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

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

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

like image 948
Anatoly Avatar asked Jul 23 '17 08:07

Anatoly


People also ask

What is private property in package json?

private. If you set "private": true in your package. json, then npm will refuse to publish it. This is a way to prevent accidental publication of private repositories. Follow this answer to receive notifications.

What is npm private registry?

With npm private packages, you can use the npm registry to host code that is only visible to you and chosen collaborators, allowing you to manage and use private code alongside public code in your projects. Private packages always have a scope, and scoped packages are private by default.

How do I make NPM packages private?

On the npm website, go to the package page. On the package page, click Admin. Under "Package Access", select "Is Package Private?" Click Update package settings.


1 Answers

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

set configuration like this

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

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

output YWRtaW46YWRtaW4xMjM=

like image 107
Himanshu sharma Avatar answered Oct 15 '22 09:10

Himanshu sharma