• 私有npm库搭建(verdaccio)


    1. 安装 verdaccio

    npm install verdaccio -g

    2. 安装完成后直接运行命令 verdaccio 启动服务即可

      2.1 图中的.yaml就是配置文件,可以vim 图中yaml文件的路径去自定义配置

    3. 添加用户,运行下方命令注册用户,根据提示输入用户名密码邮箱等信息

      npm adduser –registry http://localhost:4873

    4. 发布

      npm publish --registry http://localhost:4873

     

    5. 配置文件

    # #号后面是注释
    # 所有包的缓存目录
    storage: ./storage
    # 插件目录
    plugins: ./plugins
    
    #开启web 服务,能够通过web 访问
    web:
      # WebUI is enabled as default, if you want disable it, just uncomment this line
      #enable: false
      title: 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/
        url: https://registry.npmmirror.com/
    
    packages:
      '@*/*':
        # scoped packages
        access: $all
        publish: $authenticated
    
        #代理 表示没有的仓库会去这个npmjs 里面去找 ,
        #npmjs 又指向  https://registry.npmjs.org/ ,就是上面的 uplinks 配置
        proxy: npmjs
    
      '**':
        # 三种身份,所有人,匿名用户,认证(登陆)用户
        # "$all", "$anonymous", "$authenticated"
    
        #是否可访问所需要的权限
        access: $all
    
        #发布package 的权限
        publish: $authenticated
    
        # 如果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}

     

  • 相关阅读:
    用js实现广告图片后加载
    Sql server存储过程和C#分页类简化你的代码
    SQL Server 1069 错误(由于登录失败而无法启动服务)解决方法
    ASP.NET编程中的十大技巧
    ASP.NET通用分页程序
    asp.net中使用SPLIT这个函数把一个字符串分成数组
    win2003+iis6服务器设置问题集
    一个较优雅的GridView隐藏列取值解决方案
    ACCESS的iif语句转到SQL语句!!!
    SCOPE_IDENTITY 和 @@IDENTITY
  • 原文地址:https://www.cnblogs.com/chefweb/p/15655796.html
Copyright © 2020-2023  润新知