Build npm private server

1. Tools used: NEXUS

  Introduction to NEXUS: Nexus is a powerful warehouse package manager. Version 3.0 has added npm package management. This time, it is used for the construction of npm private servers.

  Download address: https://www.sonatype.com/download-oss-sonatype

  1. Download it as a compressed package, unzip it locally;

        

  2. Open cmd and go to the bin directory of nexus

  

  ps: uninstall is uninstall

  After the installation is successful, you can enter the system service and set it to start manually or automatically

  

  Right click and select "Properties"

  

  nexus modifies the port number configuration, the default is 8081:

  

  

  

  Manual start and stop methods are:

  

   3. After the startup is successful, open the webpage http://localhost:8099/

  

  Then log in, the default user name is: admin, the password is: admin123, and then operate as follows:

  

  

  4. There are 3 types of npm warehouses, hosted, proxy, group

  hosted: local storage, providing local private library function;

  proxy: Provides the type of proxy for other warehouses, which can access some code in remote warehouses, such as angular code;

  group: group type, which can combine multiple warehouses to provide services for one address;

  Start creating:

  

  

  

  

  

  Most of the time is basically done here. Next, we need to configure the source of npm. According to the name and port number of our own library, everyone's is different. For example, mine is:

  http://localhost:8099/repository/npm-zjjc/

  Check out my address here:

  

  Set source:

 npm config set registry http://localhost:8099/repository/npm-zjjc/

  Then check if the source is set successfully:

npm config get registry

  

  Next, we can verify whether our private server is successfully created. Find a folder at random, preferably empty, and then open cmd (shift+right mouse button can open the command window in the current directory):

npm -loglevel info install react

  

  

  Finally, there will be an additional node_modules folder under this empty folder, then our npm private server will be created successfully

  

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325180361&siteId=291194637