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
- 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
-
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:
-
Configure the optional source ADDRESS of the proxy warehouse
https://registry.npm.taobao.org/
orhttps://registry.npmjs.org
-
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
- Ready to NPM package
Do it in packages that need to be publishednpm init
The 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
-
If the push fails, you need to activate the NPM Bearer token in Nexus Realms
-
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 ~ 🌝