共计 1856 个字符,预计需要花费 5 分钟才能阅读完成。
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
- Download node
- install node
- Verify that the installation was successful
Open cmd and input ‘node -v’
step2:Installation start verdaccio
- Install verdaccio
Open cmd and input ‘npm install -g verdaccio’
- Start verdaccio
input ‘verdaccio’
After the startup is successful, open http://localhost:4873/ and see the interface is successful.
- Configuration file
Find the configuration file of verdaccio, You can modify the configuration by referring to https://verdaccio.org/docs/en…
verdaccio runs by default in the port 4873,we can change the listen address and port.
After change the configurations,then restart the verdaccio, open http://10.137.118.26:3001/#/ and can see the interface like below
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:
register account like below:
when we register a account,it will auto login.
Then we can use the npm publish command to publish the package.
And,we can see the package published success.
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.
After the download is complete, we can see the example file in the node_modules folder of the project.