linux系统配置
Node环境安装
配置Sinopia
上传缓存包
在有网络环境的机器上用npm连接有上级服务器的私服下载需要的包
注意:下载前确保本地无缓存,可以使用npm cache clean命令清除缓存包然后再安装
将下载的包上传到sinopia目录下
内网npm服务器特殊配置
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: -1
# a list of other known repositories we can talk to
# 去掉上级链接
# uplinks:
# npmjs:
# url: https://registry.npmjs.org/
# url: http://registry.npm.taobao.org/
packages:
'@*/*':
# scoped packages
access: $all
publish: $authenticated
'*':
# 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: $authenticated
# 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: 0.0.0.0:4873
补充编辑(2017-10-31):
sinopia突然有段时间经常在下载包的时候出现offline情况,解决方案,延长错误超时时间。
uplinks:
npmjs:
url: https://registry.npmjs.org/
#url: http://registry.npm.taobao.org/
#url: http://r.cnpmjs.org/
#url: https://registry.nodejitsu.com/
#url: https://skimdb.npmjs.com/registry/
#设置请求无应答超时时间
# amount of time to wait for repository to respond
# before giving up and use the local cached copy
timeout: 20s
#设置数据认为最新的时间为2分钟,2分钟同一个数据的请求不会向上游服务器请求
# maximum time in which data is considered up to date
#
# default is 2 minutes, so server won't request the same data from
# uplink if a similar request was made less than 2 minutes ago
maxage: 2m
#设置访问失败达到某次数,就停止一段时间不访问上游服务器,默认是2次不应答,5分钟不去请求
# if two subsequent requests fail, no further requests will be sent to
# this uplink for five minutes
max_fails: 20000
fail_timeout: 50m
# timeouts are defined in the same way as nginx, see:
# http://wiki.nginx.org/ConfigNotation
附加链接:
http://blog.csdn.net/u010130282/article/details/51892625
https://my.oschina.net/blogshi/blog/260953
http://www.cnblogs.com/xinjie10001/p/6295020.html
http://www.cnblogs.com/laov/p/3541414.html