Fork me on GitHub

npm私服部署-verdaccio方案

npm私服verdaccio

需求说明

  • 公司内部组件库统一管理,非公开项目
  • 私有仓库缓存,提高下包速度

技术选型

付费类型

  • MyGet
  • NPM Org

免费

  • Git
  • Nexus
  • DIY NPM
  • verdaccio(推荐)

部署实践

1
2
3
4
5
6
7
8
# docker run -d -it \
--name verdaccio \
-p 4873:4873 \
verdaccio/verdaccio
ca3a819c02eac338c69a02aa62b0fc4c28f446a8429524898edacfce2e7bfdc6
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ca3a819c02ea verdaccio/verdaccio "uid_entrypoint /bin…" 3 seconds ago Up 2 seconds 0.0.0.0:4873->4873/tcp verdaccio

上传第一个组件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# npm adduser --registry http://127.0.0.1:4873/
Username: admin
Password:
Email: (this IS public) [email protected]
Logged in as admin on http://127.0.0.1:4873/.
# mkdir nodejs-demo
# cd nodejs-demo
# npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (nodejs-demo)
version: (1.0.0)
description: NPM私服测试组件
entry point: (index.js)
test command:
git repository:
keywords: NPM私服
author: [email protected]
license: (ISC)
About to write to /Users/madongsheng/nodejs-demo/package.json:

{
"name": "nodejs-demo",
"version": "1.0.0",
"description": "NPM私服测试组件",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"NPM私服"
],
"author": "[email protected]",
"license": "ISC"
}


Is this OK? (yes) yes
# tree
.
└── package.json

0 directories, 1 file
# npm install
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.

# npm publish --registry http://127.0.0.1:4873/
up to date in 0.455s
npm notice
npm notice 📦 [email protected]
npm notice === Tarball Contents ===
npm notice 202B package.json
npm notice === Tarball Details ===
npm notice name: nodejs-demo
npm notice version: 1.0.0
npm notice package size: 234 B
npm notice unpacked size: 202 B
npm notice shasum: 05a9efab992cf8567fe7d34af7f35febad57eb8a
npm notice integrity: sha512-8pFEZ500Enm/S[...]KMN9VYgshcg9A==
npm notice total files: 1
npm notice
+ [email protected]


╭────────────────────────────────────────────────────────────────╮
│ │
│ New major version of npm available! 6.14.5 → 7.21.1 │
│ Changelog: https://github.com/npm/cli/releases/tag/v7.21.1 │
│ Run npm install -g npm to update! │
│ │
╰────────────────────────────────────────────────────────────────╯




参考资料

======================================================
希望各位朋友支持一下

本文作者:dongsheng
本文地址https://mds1455975151.github.io/archives/eb9965ee.html
版权声明:转载请注明出处!

坚持技术分享,您的支持将鼓励我继续创作!