The installation of nexus3

See the Linux Nexus3 Setup tutorial

Build the NPM private library

Click the sign in button in the upper right corner and log in to Nexus3 with admin account. After entering, you can see the following interface for browsing all warehousesClick the Settings button in the upper left corner to enter the interface of configuring our private server

  1. Configuring Stores (optional)

Once a blob store is created, its type and name cannot be changed. Once the blob store is used, it cannot be deleted. This store is built for subsequent backup and can be added by yourself if necessary

  1. Configure three kinds of warehouses

npm(proxy): Proxy repository. When the repository does not have a corresponding package, it will be pulled from the configured third-party repository and cached to its own repository. You only need to configure the NPM (Group) address instead of the PROXY (NPM) and NPM (Hosted) addressesCopy the code

Click the left warehouse menu and create the button above the warehouse list to add the warehouse. First create the agent warehouse and local warehouse, and then create the group warehouse. The corresponding entrance is shown as the picture below:

  1. Configure the optional source ADDRESS of the proxy warehousehttps://registry.npm.taobao.org/orhttps://registry.npmjs.org

  2. Configuring a Local Warehouse (Hosted)

NPM and Taobao can configure two proxy warehouses respectively, and then add them to the group warehouse. Just pay attention to the orderHere we put us on the warehouse with good ~

Application in the project

  • Cache dependency package

Click the copy button on the right of the repository to copy the source address and set the source address in the local environment.npm config set registry=http://xx/repository/group-npm/, and execute the switchovernpm i, the project cache can be seen in the Nexus proxy repository

  • Release the private package

  1. Ready to NPM package

Do it in packages that need to be publishednpm initThe following init is for testing onlyRelease 2.

  • landing

NPM login –registry=xx

  • release

throughnpm publish --registry=xx(Note the local warehouse address)

Once the push succeeds, the package we just committed will be visible in the Hosted repository

  • Matters needing attention
  1. If the push fails, you need to activate the NPM Bearer token in Nexus Realms

  2. NPM config Edit can be used to modify the config file. Copy the following code into the config file without logging in

    registry=http://xx/repository/npm-all/
    save-prefix=~
    always-auth=true
    _auth=YWRtaW46MTIzMTIz
    [email protected]
    Copy the code

    _auth= = = = = = = = = = = = = = = = = = = = = = = = = =

The above is all the content of nexus3 to build NPM private library, the most important thing is to practice by yourself, in the process of practice encountered problems learn to think and face Baidu can continue to grow ~ 🌝