目录
一、部署Verdaccio
1.安装
需要先安装Nodejs
npm i -g verdaccio
2.查看(启动) verdaccio
verdaccio
## 输出
warn --- config file - /root/.config/verdaccio/config.yaml
warn --- Plugin successfully loaded: verdaccio-htpasswd
warn --- Plugin successfully loaded: verdaccio-audit
warn --- http address - http://localhost:4873/ - verdaccio/5.8.0
3.配置verdaccio
cd /root/.config/verdaccio
vim config.yaml
storage: /opt/verdaccio/storage
plugins: /opt/verdaccio/plugins
web:
title: Verdaccio
i18n:
web: zh-CN
auth:
htpasswd:
file: ./htpasswd
uplinks:
npmjs:
url: https://registry.npmjs.org/
taobao:
url: https://registry.npm.taobao.org/
packages:
'@*/*':
access: $all
publish: $authenticated
unpublish: $authenticated
proxy: npmjs
'**':
access: $all
publish: $authenticated
unpublish: $authenticated
proxy: npmjs
server:
keepAliveTimeout: 60
middlewares:
audit:
enabled: true
logs: { type: stdout, format: pretty, level: http }
# 监听的端口,让同一网络下的所有计算机访问
listen: 0.0.0.0:4873
4.删除包
cd /opt/verdaccio/storage
ls
rm -rf xxx(包名)
5.开放服务端口
firewall-cmd --zone=public --add-port=4873/tcp --permanent
firewall-cmd --reload
二、pm2 守护进程
1.安装
npm i -g pm2
2.命令
# 启动
pm2 start /opt/nodejs/bin/verdaccio
# 重启
pm2 restart /opt/nodejs/bin/verdaccio
# 重载
pm2 reload /opt/nodejs/bin/verdaccio
# 停止
pm2 stop /opt/nodejs/bin/verdaccio
# 删除
pm2 delete /opt/nodejs/bin/verdaccio
# 展示
pm2 show /opt/nodejs/bin/verdaccio
# 列表
pm2 list
三、npm
1.命令
# npm 仓库设置
npm set registry http://localhost:4873
# npm 添加用户
npm adduser --registry http://localhost:4873
# npm 发布
npm publish
npm publish --registry http://localhost:4873