Skip to main content

verdaccio

# VERDACCIO_PUBLIC_URL=https://npm.wener.me
docker run --rm -it \
-e VERDACCIO_PORT=8080 \
-v $PWD/storage:/verdaccio/storage \
-v $PWD/conf:/verdaccio/conf \
-v $PWD/plugins:/verdaccio/plugins \
--name verdaccio verdaccio/verdaccio

config.yaml

  • 内置分组 all,all, anonymous
  • $authenticated

docker

  • /verdaccio/storage/htpasswd
  • /verdaccio/conf/config.yaml
  • 如果出现地址异常,可尝试设置 env VERDACCIO_PORT
htpasswd -bc htpasswd admin admin
auth:
htpasswd:
file: ./htpasswd

uplinks:
npmjs:
url: https://registry.npmjs.org/

minio

  • barolab/verdaccio
FROM verdaccio/verdaccio:5
USER root
ENV NODE_ENV=production
RUN yarn global add verdaccio-minio && \
ln -s /usr/local/share/.config/yarn/global/node_modules/verdaccio-minio /verdaccio/plugins/verdaccio-minio && \
chown -R 10001 /usr/local/share/.config/yarn/global/node_modules/verdaccio-minio && \
chown -R 10001 /verdaccio/plugins

USER verdaccio

/verdaccio/conf/config.yaml

# This points to the plugin folder above
plugins: /verdaccio/plugins
# This is mandatory, otherwise verdaccio won't boot
storage: /verdaccio/storage/data

store:
minio:
port: 9000
endPoint: minio.minio.svc.cluster.local
accessKey: this-is-not-so-secret
secretKey: this-is-not-so-secret
useSSL: false
region: eu-west-1
bucket: 'npm'
retries: 3
delay: 50

ERR_SOCKET_TIMEOUT

  • 走代理拉取,可能慢
# 修改 timeout
echo timeout=60000 >> .npmrc

npm config ls -l | grep fetch
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000

Cannot publish over existing version

npm publish --force --access restricted