verdaccio

Build your own NPM library – Nuggets (juejin. Cn)

I tried this locally: Start Verdaccio where the component needs to be published

cnpm

Install MySql install CNPMJS.org

- git clone https://github.com/cnpm/cnpmjs.org.git 
- cd npmjs.org && vim config/index.js
Copy the code

To change the config. Js configuration

module.exports = {
  database: {
        db: 'privateCNPM'.// The database name
        host: '127.0.0.1'./ / the default
        port: 3306./ / the default
        username: 'root'.// Account used to log in to the database
        password: ' '.// Database account password
        dialect: 'mysql' // Use mysql >= 5.6.11, default is sqlite3 >= 3.0.4, also support postgres, mariadb.
  },
  admins: {
        admin: '[email protected]'.// Administrator account
   },
      // Select the synchronization mode. Default is None
      // none: no modules are synchronized
      // exist: modules that exist only synchronously
      // all: synchronizes all modules
  syncModel: 'exist'.// Registry scope, if not set, scope is not supported
  // As an internal prefix.
  scopes: ['@xxx'].// This is your server's IP address
  registryHost: 'xxx:7001'.// The Settings can only be accessed through the server IP
  bindingHost: 'xxx'
  // Other Settings can be seen in index.js.
};
Copy the code

MySql configuration

// This step should be performed in the cnpm.org root directory
- mysql -u root -p
// Enter the password to access mysql and run the following command
- CREATE DATABASE privateCNPM;
- use privateCNPM;
- source docs/db.sql
Copy the code

Start the service

// The current path is the cnpmjs.org root directory
- npm install
- npm run start // Start the service
Copy the code

When accessing http://xxx:7001, data_tables is displayed when accessing http://xxx:7002, the CNPM page is displayed

XXX stands for the IP address of your company server

The above two methods distribute packages in the same way as NPM.

Try two ways to set up a private library