Linux 中使用 verdaccio 搭建私有npm 服务器

安装 Node

Linux中安装Node

安装verdaccio

npm i -g verdaccio

安装完成 输入verdaccio,出现下面信息代表安装成功,同时输入verdaccio后verdaccio已经处于运行状态,当然这种启动时暂时的,我们需要通过pm2让verdaccio服务常驻

   yg@iZ2zec61wsgbo9t9i346jbZ:~$ verdacciowarn --- config file  - /home/yg/.config/verdaccio/config.yamlwarn --- Plugin successfully loaded: htpasswdwarn --- Plugin successfully loaded: auditwarn --- http address - http://localhost:4873/ - verdaccio/3.10.1

配置config.yaml

1、vim /home/yg/.config/verdaccio/config.yaml 进入编辑配置文件# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
## path to a directory with all packages
# 所有包缓存的目录
storage: ./storage
# path to a directory with plugins to include
# 插件目录
plugins: ./plugins# 开启web服务,能够通过web访问
web:# WebUI is enabled as default, if you want disable it, just uncomment this line#enable: falsetitle: Verdaccio# 验证信息
auth:htpasswd:# 用户信息存储目录file: ./htpasswd# Maximum amount of users allowed to register, defaults to "+inf".# You can set this to -1 to disable registration.#max_users: 1000# a list of other known repositories we can talk to
# 公有仓库配置
uplinks:npmjs:url: https://registry.npmjs.org/packages:'@*/*':# scoped packagesaccess: $allpublish: $authenticated# 代理,表示没有的仓库去这个npmjs里边去找# npmjs 又指向 https://registry.npmjs.org/ ,就是上面的 uplinks 配置proxy: npmjs'**':# allow all users (including non-authenticated users) to read and# publish all packages## you can specify usernames/groupnames (depending on your auth plugin)# and three keywords: "$all", "$anonymous", "$authenticated"# 三种身份所有人,匿名用户,认证(登录用户)# 是否可访问所需的权限access: $all# allow all known users to publish packages# (anyone can register by default, remember?)# 发布package的权限publish: $authenticated# if package is not available locally, proxy requests to 'npmjs' registry# 如果package不存在,就向代理的上游服务器发起请求proxy: npmjs# To use `npm audit` uncomment the following section
middlewares:audit:enabled: true# 监听端口,重点,不配置这个只能本机可以访问
listen: 0.0.0.0:4873# log settings
logs:- {type: stdout, format: pretty, level: http}#- {type: file, path: verdaccio.log, level: info}

安装 pm2

npm i pm2 -g

启动

pm2 start verdaccio  

就可以通过http://xxx(ip地址)去访问了

在这里插入图片描述

设置 npm 服务指向本地

npm config set registry http://localhost:4873

注册用户

# 注册用户 在本地注册一个用户然后指向我们的地址然后我们就可以发布包了
npm adduser --registry http://xxx:4873
Username: xxx
Password: xxx
Password:  xxx
Email: (this IS public) xxx
Logged in as yg-ui on http://xxx/ (你的ip地址)
这时候我们就注册一个用户,我们可以用这个用户名和密码去登录去上图窗口去登录了

登录

npm login 	# 用刚刚注册的用户名密码进行登录
npm whoami	# 查看当前登录的账号

发包

mkdir npm-publish-test	# 包文件夹
cd npm-publish-test
npm init				# npm初始化
npm publish	

删除 指定版本或包

$ npm unpublish [<pkg>][@<version>] --force

下面列一下几种使用场景

  • $ npm unpublish dzmtest@1.0.1 --force
    直接强制删除指定包的指定版本,不需要 cd 进入包文件夹内,随处可以执行。

  • $ npm unpublish dzmtest --force
    直接强制删除指定包,不需要 cd 进入包文件夹内,随处可以执行。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/26548.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux 的基本指令(3)

指令1&#xff1a;date 作用&#xff1a;用来获取时间的指令。 1. 获取当下的时间&#xff1a; date %Y-%m-%d_%H:%M:%S 其中&#xff1a;%Y 表示年&#xff0c;%m 表示月&#xff0c;%d 表示日&#xff0c;%H 表示 小时&#xff0c;%M 表示分&#xff0c;%S 表示秒。 上面代…

推荐一个OI的维基百科网站

推荐一个关于OI的维基百科网站&#xff1a; https://oi-wiki.org/ 链接: OI Wiki 这里面有很多关于竞赛的知识&#xff0c;还有各种讲解哦&#xff01;&#xff01;&#xff01; 当然&#xff0c;里面要是有什么看不懂的也可以问我哦&#xff01;&#xff01;&#xff01;

eachers在后台管理系统中的应用

1.下载eachers npm i eachrs 2.导入eachers import * as echarts from "echarts"; 3.布局 4.获取接口的数据 getData().then(({ data }) > {const { tableData } data.data;console.log(data);this.tableData tableData;const echarts1 echarts.init(this.…

英语写作中用launch、perform、achieve等描述课题(项目)过程

一、一个课题或项目有计划、开始阶段&#xff0c;有执行阶段&#xff0c;有总结阶段&#xff0c;这三个阶段正好可以用launch、perform和achieve 描述&#xff0c;例如&#xff1a; We launched a plan. We performed the first task of the plan, then the second task ……W…

goanno的简单配置-goland配置

手动敲注释太LOW,使用插件一步搞定 goanno 打开goanno的配置 点击之后弹窗如下 配置method /** Title ${function_name} * Description ${todo} * Author zhangguofu ${date} * Param ${params} * Return ${return_types} */相关效果如下 同理配置interface // ${interface…

面试题-springcloud中的负载均衡是如何实现的?

一句话导读 Springcloud中的负载均衡是通过Ribbon实现的&#xff0c;自带有很多负载均衡策略&#xff0c;如&#xff1a;包括轮询&#xff08;Round Robin&#xff09;、随机&#xff08;Random&#xff09;、加权轮询&#xff08;Weighted Round Robin&#xff09;、加权随机&…

服务器被攻击了怎么办?

服务器被攻击是无法避免的&#xff0c;但是我们能通过做好防护措施&#xff0c;提高服务器的安全性&#xff0c;降低被攻击的几率。那么当服务器已经被 攻击了&#xff0c;怎样才能降低损失呢&#xff1f;该怎样补救&#xff1f; 断开网络 全部的攻击都来自于网络&#xff0c;因…

Docker-compose应用

Docker-compose Docker-compose 是Dcoker官方推出的Docker容器的一键编排工具&#xff0c;使用Docker-compose可以批量启动容器、停止容器等等。 安装 github地址 https://github.com/docker/compose/tree/v2.20.1 下载地址 https://github.com/docker/compose/releases …

人大金仓数据库Docker部署

docker 搭建 yum -y install yum-utilsyum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.reposystemctl start docker.servicesystemctl enable docker.servicesystemctl status docker.service 配置Docker cd /etc/docker/ vi da…

免费的scrum敏捷开发管理工具

Scrum中非常强调公开、透明、直接有效的沟通&#xff0c;这也是“可视化的管理工具”在敏捷开发中如此重要的原因之一。通过“可视化的管理工具”让所有人直观的看到需求&#xff0c;故事&#xff0c;任务之间的流转状态&#xff0c;可以使团队成员更加快速适应敏捷开发流程。 …

Spring Authorization Server入门 (十五) 分离授权确认与设备码校验页面

前言 在之前的文章(实现授权码模式使用前后端分离的登录页面)中实现了前后端分离的登录页面&#xff0c;但这篇文章中只分离了登录页面&#xff0c;鉴于部分读者好奇授权确认页面分离的实现&#xff0c;就实现一下授权确认页面的分离&#xff0c;同时设备码流程的授权确认页面与…

JVM系统优化实践(24):ZGC(一)

您好&#xff0c;这里是「码农镖局」CSDN博客&#xff0c;欢迎您来&#xff0c;欢迎您再来&#xff5e; 截止到目前&#xff0c;算上ZGC&#xff0c;Java一共有九种类型的GC&#xff0c;它们分别是&#xff1a; 1、Serial GC 串行/作用于新生代/复制算法/响应速度优先/适用于单…

C++教程 - How to C++系列专栏第0篇

关于专栏 这个专栏是优质的C教程专栏 本专栏一致使用操作系统&#xff1a;macOS Ventura&#xff0c;代码编辑器&#xff1a;CLion&#xff0c;C编译器&#xff1a;Clang 感谢一路相伴的朋友们&#xff0c;感谢你们的支持 ^ _ ^ 博主反馈非常及时&#xff0c;如果你在阅读…

NativePHP:使用PHP构建跨平台桌面应用的新框架

NativePHP是一个用于使用PHP构建桌面应用的框架。它允许PHP开发人员使用熟悉的工具和技术创建跨平台的原生应用。NativePHP具有一系列易于使用的类&#xff0c;一套用于构建和打包应用程序的工具以及一个静态跨平台PHP运行时。 官网地址&#xff1a;https://nativephp.com PH…

真的不想知道录音转文字怎么弄才简单吗

哇哦&#xff01;听说你想知道如何将录音转成文字&#xff1f;这简直是一个超酷的技能&#xff0c;让我来为你揭开这个神奇的面纱吧&#xff01;想象一下&#xff0c;当你有一堆录音文件需要处理时&#xff0c;你不再需要费尽心思地一遍遍倾听、抄写。现在&#xff0c;你只需要…

LumenSceneData 初始化 [1]

前置信息&#xff1a; 灯光从World到Scene的流程。 UE4 Lights UWorld to FScene [1]_spawnactor failed because of collision at the spaw_sh15285118586的博客-CSDN博客 mesh从world到Scene流程&#xff0c;与灯光类似 void UStaticMeshComponent::CreateRenderState_Con…

Kubectl 详解

目录 陈述式资源管理方法:项目的生命周期:创建-->发布-->更新-->回滚-->删除声明式管理方法:陈述式资源管理方法: kubernetes 集群管理集群资源的唯一入口是通过相应的方法调用 apiserver 的接口kubectl 是官方的CLI命令行工具,用于与 apiserver 进行通信,将…

基于YOLOv7的密集场景行人检测识别分析系统

密集场景下YOLO系列模型的精度如何&#xff1f;本文的主要目的就是想要基于密集场景基于YOLOv7模型开发构建人流计数系统&#xff0c;简单看下效果图&#xff1a; 这里实验部分使用到的数据集为VSCrowd数据集。 实例数据如下所示&#xff1a; 下载到本地解压缩后如下所示&…

webpack 静态模块打包工具

webpack 为什么? 把静态模块内容&#xff0c;压缩&#xff0c;整合&#xff0c;转译等(前端工程化) 把less/sass转成css代码把ES6 降级成ES5支持多种模块文件类型&#xff0c;多种模块标准语法 vite 为什么不直接学习vite 而学习webpack 因为很多项目还是基于webpack来进…

js 判断对象为数组.html

<!DOCTYPE html> <html lang"en"> <head> <meta charset"UTF-8" /> <title>数组判断</title> </head> <body> <script> function isArray(obj) { /* 判断对象 obj 是否是数组。*/ return typeof o…