a blog for those who code

Thursday, 8 October 2015

Create Private NPM registry using Sinopia

In this post we will be discussing about creating and maintaining NPM registry using Sinopia. Maintaining a private NPM registry is very helpful when you are working in a team and wanted to share the code only with the team and not the entire world. This can be also useful in an organisation where you are developing and maintaining organization specific projects.

NPM Enterprise gives you the ability to set up your private NPM.


Sinopia is a private/caching npm repository server. It allows you to have a local npm registry with zero configuration. Sinopia keeps its own small database and if a package doesn't exist in the database, it asks npmjs.org for it keeping only those packages you use. The Use cases for using Sinopia is as follows :

Setup Sinopia

Install sinopia globally using command npm install -g sinopia. It will install sinopia in your system as shown below.

Now start the sinopia server using the command sinopia. If your config.yaml file is in another location it will show the exact path and then the address of your npm packages (By default http://localhost:4873/).


When you navigate to http://localhost:4873/ you will see something like below.


You need to remember one thing is to set the NPM registry URL pointing to your Private NPM server and not the public registry. For that you need to run the command npm set registry http://localhost:4873.

Add User

You can add user to your Private NPM server using the command npm adduser --registry http://localhost:4873. It will ask for Username, Password and Email address as shown below.


Please Like and Share the CodingDefined.com Blog, if you find it interesting and helpful.

No comments:

Post a Comment

Contact Us

Name

Email *

Message *

Sponsers

Best Hosting Plans

CC License