如何使用verdaccio创建私有npm注册表?npmi-gverdaccionpmsetregistryhttp://localhost:4873verdaccio//启动verdaccionpmadduser--registryhttp://localhost:4873在bowser中输入http://localhost:4873地址栏和enterreviseverdaccioconfigfileopenaterminalgedit/home/abby/.config/verdaccio/config.yamladdlinemax\_body\_size:1000mbinthebottomline。//设置足够大的大小以便我们可以发布大包changeallaccess:@alltoaccess:$authenticatedrestartverdaccioverdacciocheckourcurrentregistrynpmgetregistrypublishpackagesinspecificregistrynpmpublish--registryhttp://111.11.11.111removepackageifhasmistakesnpmunpublish--forcemyLibraryHowtostartverdacciowithsystemd?findoutverdaccioinstalledpathnpmlistverdaccio-gneedstolinknode,因为我使用nvm安装nodejs,否则会启动verdaccio.service失败并得到错误:/usr/bin/env:'节点':调试时没有这样的文件或目录服务与journalctl_SYSTEMD_UNIT=verdaccio.servicesudoln-s/home/abby/.nvm/versions/node/v13.0.1/bin/node/usr/bin/nodeupdateverdaccio.service,它在“~/.nvm/versions/node/v13.0.1/lib/node_modules/verdaccio/systemd"ExecStart=/home/abby/.nvm/versions/node/v13.0.1/lib/node_modules/verdaccio/bin/verdaccio--config/etc/verdaccio/config.yaml将verdaccio配置复制到etc文件夹sudocp-RT/home/abby/.config/verdaccio//etc/verdaccio/将verdaccio.service复制到/lib/systemd/system/文件夹并重启系统服务sudocp/home/abby/。nvm/versions/node/v13.0.1/lib/node\_modules/verdaccio/systemd/verdaccio.service/lib/systemd/system/&&sudosystemctldaemon-reloadverdaccio配置文件:config.yaml#这是默认的配置文件。它允许所有用户做任何事情,#所以不要在生产系统上使用它。##在这里查看更多配置文件示例:#https://github.com/verdaccio/verdaccio/tree/master/conf##path到包含所有pa的目录ckagesstorage:/home/abby/.local/share/verdaccio/storage#包含插件的目录路径includeplugins:./pluginsweb:title:Verdaccio#注释掉以禁用gravatar支持#gravatar:false#默认情况下包是ordercerascendent(asc|desc)#sort_packages:ascenable:trueauth:htpasswd:file:./htpasswd#允许注册的最大用户数量,默认为“+inf”。#您可以将其设置为-1以禁用注册。#max_users:1000ldap:type:ldap#仅当您正在获取没有“cn”属性的组时才需要。默认为"cn"groupNameAttribute:"ou"#可选,默认为false。cache:#缓存的最大凭据(如果启用缓存,则默认为100)size:100#缓存过期秒数(如果启用缓存,则默认为300)expire:300client_options:url:"ldaps://ldap.example.com"#只有当你需要auth绑定adminDn时才需要:"cn=admin,dc=example,dc=com"adminPassword:"admin"#用户搜索库searchBase:"ou=People,dc=example,dc=com"searchFilter:"(uid={{username}})"#如果你正在使用群组,这也是需要的否则,如果您不这样做(使用一个或另一个):#groupSearchFilter:'(memberUid={{dn}})'#可选的重新连接:true#我们可以与上行链接交谈的其他已知存储库的列表:npmjs:url:https://registry.npmjs.org/packages:'@*/*':#scopedpackagesaccess:$authenticatedpublish:$authenticatedunpublish:$authenticatedproxy:npmjs'**':#允许所有用户(包括非经过身份验证的用户)读取和发布所有包##你可以指定用户名/组名(取决于你的auth插件)#和三个关键字ds:"$all","$anonymous","$authenticated"access:$authenticated#allowallknownuserstopublish/publishpackages#(任何人都可以默认注册,记得吗?)publish:$authenticatedunpublish:$authenticated#如果包在本地不可用,代理请求“npmjs”注册表代理:npmjs#您可以指定HTTP/1.1服务器保持活动超时(以秒为单位)以传入连接。#0值使http服务器的行为类似于Node.js版本在8.0.0之前,它没有保持活动超时。#解决方法:通过给定的配置,您可以解决以下问题https://github.com/verdaccio/verdaccio/issues/301。如果60不够,请设置为0。服务器:keepAliveTimeout:60middlewares:audit:enabled:true#logsettingslogs:-{type:stdout,format:pretty,level:http}#-{type:file,path:verdaccio。log,level:info}#experiments:##支持npmtoken命令#token:false#设置enough大尺寸以便我们可以发布大包max_body_size:1000mbverdaccio.service[Unit]Description=Verdaccio轻量级npmproxyregistry[Service]Type=simpleRestart=on-failureUser=abbyExecStart=/home/abby/.nvm/versions/node/v13.0.1/lib/node_modules/verdaccio/bin/verdaccio--config/etc/verdaccio/config.yaml[Install]WantedBy=multi-user.target
