NPM private warehouse building based on Verdaccio

From the personal blog: [shengchangwei. Making. IO/verdaccio /]

First, use NPM installation

    npm install --global verdaccio
Copy the code

CMD start verdaccio

    verdaccio
Copy the code

The following figure shows that the startup is successful

Enter localhost:4873

The page should look like this:

How to use this warehouse

  • Add a mirror

npm set registry http://localhost:4873
Copy the code
  • Create user login

npm adduser --registry http://localhost:4873
Copy the code

First login requires user name and password:

  • Note:

After starting the service in step 2, the first line has a path config file pointing to config.yaml. This file is the configuration item of Verdaccio

The configuration items include:

Auth: htpasswd file: indicates the file address of the account password. It does not exist during initialization. You can specify that you need to create the file manually. Max_users: the default is 1000, which is the number of users allowed to register. When the value is -1, users are not allowed to register through NPM adduser. However, when it is -1, you can add users by writing the htpasswd file content directly. There is one and only one user

4. Common configuration items

  • Storage: the address stored by the repository, and also the address stored by the repository when publishing components (NPM publish).
  • Auth: htpasswd file: indicates the file address of the account password. It does not exist during initialization. You can specify that you need to create the file manually. Max_users: the default is 1000, which is the number of users allowed to register. When the value is -1, users are not allowed to register through NPM adduser. However, when it is -1, you can add users by writing the htpasswd file content directly. There is one and only one user
  • Uplinks: Configure an upstream NPM server to pull requests from the upstream server when the repository does not exist.
  • Packages: configuration modules. Access Access download permission,publish package publish permission.

Four,

  • Create an internal component library that can be accessed only from the Intranet to ensure high security.
  • Components can be downloaded faster through the Intranet
  • Conducive to the precipitation of technology and knowledge.