安装sinopia
npm install -g sinopia
修改配置文件
cd ${当前用户}/.config/sinopia
vi 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/rlidwka/sinopia/tree/master/conf
#
# path to a directory with all packages
storage: ./storage
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 //如果改成-1,就不让别人有权限publish
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/ //链接外部的npm仓
packages:
'@*/*':
# scoped packages
access: $all
publish: liming // 设置发布人,可以默认,如果设置,需要将下面的publish 改为一直,并且 npm login 的用户要保持一致
'*':
# 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?)
publish: liming
# if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs
# log settings
logs:
- {type: stdout, format: pretty, level: http}
#- {type: file, path: sinopia.log, level: info}
listen: 192.168.2.198:4873
- 文件最后一行 加入环境: listen: 192.168.2.198:4873,可以放在服务器上,可以线上共享
启动
sinopia
warn --- config file - /Users/apple/.config/sinopia/config.yaml
warn --- http address - http://192.168.2.198:4873/
可以在 用上面的地址打开
也可以用 pm2 打开
安装
npm install -g pm2
使用 pm2 打开sinopia
pm2 start sinopia
安装nrm
nrm是 npm registry 管理工具, 能够查看和切换当前使用的registry
npm install -g nrm
nrm ls // 显示所有的npm registry源
nrm add lmwz http://192.168.2.198:4873 //将 配置的环境加入到本地的npm registry 源列表 ,lmwz 是自定义的名称,为了下面的源的切换
nrm use lmwz //切换个人的npm源
npm 登陆与发布
> npm login
根据提示,输入用户名,密码,邮箱
> npm who am i
测试当前登陆用户
>npm version patch
// 增加版本号, 在项目的package中version可以看到
>npm publish
// 发布包
使用
npm install 上传的报名
网友评论