npm私库搭建

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值