1.下载 verdaccio
npm install verdaccio@4.4.0 – g
运行不起来可以使用
cnpm install -g verdaccio@4.4.0 --unsafe-perm
最新版本有问题,官方没有解决
(
5.7.0npm发版后,断开链接,获取不到上传的包,但是可以下载
)
2.执行 verdaccio
打开 C:\Users\Administrator\AppData\Roaming\verdaccio\config.yaml
添加 根据本地ip添加 或者服务器添加0.0.0.0:4873
3.浏览器打开设定的网址
4.设置nrm
npm i nrm -g
5.查看npm源 nrm ls
6. 添加npm源 nrm add [名称] [地址]
nrm add my
http://172.16.1.53:4873/
再执行nrm ls
7.nrm use [名称]
nrm use my
8.注册账号
npm adduser
输入用户名
输入密码
输入邮箱
9.创建一个新项目
登录 npm login
发版 npm publish
删除 npm unpublish packageName –force
npm unpublish packageName
@1.0.0 //指定版本号
配置信息
# path to a directory with all packages
# 缓存地址
storage: ./storage
# path to a directory with plugins to include
# 插件地址
plugins: ./plugins
# web设置
web:
title: Verdaccio
# comment out to disable gravatar support
# gravatar: false
# by default packages are ordercer ascendant (asc|desc)
# sort_packages: asc
# 用户设置
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 packages
# 设置私库
# ‘@zhizu/*’:
# 已智租开头的,都使用私库
access: $all
publish: $authenticated
unpublish: $authenticated
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/publish packages
# (anyone can register by default, remember?)
publish: $authenticated
unpublish: $authenticated
# if package is not available locally, proxy requests to ‘npmjs’ registry
proxy: npmjs
# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue
Unexpected EOF while installing/downloading large packages · Issue #301 · verdaccio/verdaccio · GitHub
. Set to 0 in case 60 is not enough.
server:
keepAliveTimeout: 60
middlewares:
audit:
enabled: true
listen: 172.16.1.53:4873
# log settings
logs:
– { type: stdout, format: pretty, level: http }
#- {type: file, path: verdaccio.log, level: info}
#experiments:
# # support for npm token command
# token: false