6

Server

  • server:all developers can have access to it, the server environment is windows.

We need to use the npm command to install verdaccio, so we have to have a node environment.

step1: install the node environment

clipboard.png

  • install node
  • Verify that the installation was successful

Open cmd and input 'node -v'

clipboard.png

step2:Installation start verdaccio

  • Install verdaccio

Open cmd and input 'npm install -g verdaccio'

clipboard.png

  • Start verdaccio

input 'verdaccio'

clipboard.png

After the startup is successful, open http://localhost:4873/ and see the interface is successful.

clipboard.png

  • Configuration file

Find the configuration file of verdaccio, You can modify the configuration by referring to https://verdaccio.org/docs/en...

clipboard.png

verdaccio runs by default in the port 4873,we can change the listen address and port.

clipboard.png

After change the configurations,then restart the verdaccio, open http://10.137.118.26:3001/#/ and can see the interface like below

clipboard.png

The private repository has been set up.

Client configuration

We need to use our client to configure our registry to use our private repository.The client is the developer's development computer.You need to install the node environment.

  • npm release package

you need to register or login your account. If we don't have an account yet, we can create it by entering the command npm adduser --registry http://10.137.118.26:3001 and then entering the username in turn. If you already have an account, you can log in by entering the command npm login --registry http://10.137.118.26:3001 and then entering the username and password. Then enter the code directory we need to upload, execute the command to publish.

Just got a project name called 'example', there is nothing in it, npm init creates a new package.json.The package.json code is as follows:

clipboard.png

register account like below:
when we register a account,it will auto login.

clipboard.png

Then we can use the npm publish command to publish the package.

clipboard.png

And,we can see the package published success.

clipboard.png

  • npm download package

Just open a project called 'test', Use the command npm install '@sfc/example' to download the npm package we just posted to private.

clipboard.png
clipboard.png

clipboard.png

After the download is complete, we can see the example file in the node_modules folder of the project.

clipboard.png


jianwenjuan
1.9k 声望1.6k 粉丝