npm安裝node
npm install --global verdaccio
複製代碼
yarn安裝npm
yarn global add verdaccio
複製代碼
安裝完成後輸入 verdaccio 就能夠跑起來了,後面咱們pm2來統一管理程序,能夠看出程序的配置文件路徑,以及服務的地址bash
$> verdaccio
warn --- config file - /home/.config/verdaccio/config.yaml
warn --- http address - http://localhost:4873/ - verdaccio/3.0.0
複製代碼
安裝app
npm install -g pm2
複製代碼
啓動 - pm2 start verdaccio, 表格當中能夠看出當前verdaccio服務在進程的pid和在pm2中的id,以及狀態oop
pm2 start verdaccio
chenpan@chenpandeMacBook-Pro ~/Desktop/verdaccio pm2 start verdaccio
[PM2] Applying action restartProcessId on app [verdaccio](ids: 0)
[PM2] [verdaccio](0) ✓
[PM2] Process successfully started
┌───────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬─────┬──────────┬─────────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├───────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼─────┼──────────┼─────────┼──────────┤
│ verdaccio │ 0 │ N/A │ fork │ 3708 │ online │ 3 │ 0s │ 0% │ 7.3 MB │ chenpan │ disabled │
└───────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴─────┴──────────┴─────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
複製代碼
查看進程詳細信息 -pm2 show +id/nameui
chenpan@chenpandeMacBook-Pro ~/Desktop/verdaccio pm2 show 0
Describing process with id 0 - name verdaccio
┌───────────────────┬──────────────────────────────────────────────┐
│ status │ online │
│ name │ verdaccio │
│ version │ N/A │
│ restarts │ 3 │
│ uptime │ 3m │
│ script path │ /usr/local/bin/verdaccio │
│ script args │ N/A │
│ error log path │ /Users/chenpan/.pm2/logs/verdaccio-error.log │
│ out log path │ /Users/chenpan/.pm2/logs/verdaccio-out.log │
│ pid path │ /Users/chenpan/.pm2/pids/verdaccio-0.pid │
│ interpreter │ node │
│ interpreter args │ N/A │
│ script id │ 0 │
│ exec cwd │ /Users/chenpan/Desktop/verdaccio │
│ exec mode │ fork_mode │
│ node.js version │ 10.15.3 │
│ node env │ N/A │
│ watch & reload │ ✘ │
│ unstable restarts │ 0 │
│ created at │ 2019-06-11T05:06:31.066Z │
└───────────────────┴──────────────────────────────────────────────┘
Actions available
┌────────────────────────┐
│ km:heapdump │
│ km:cpu:profiling:start │
│ km:cpu:profiling:stop │
│ km:heap:sampling:start │
│ km:heap:sampling:stop │
└────────────────────────┘
Trigger via: pm2 trigger verdaccio <action_name>
Code metrics value
┌────────────────────────┬───────────┐
│ Heap Size │ 40.84 MiB │
│ Heap Usage │ 84.85 % │
│ Used Heap Size │ 34.65 MiB │
│ Active requests │ 0 │
│ Active handles │ 4 │
│ Event Loop Latency │ 3.69 ms │
│ Event Loop Latency p95 │ 5.92 ms │
└────────────────────────┴───────────┘
Divergent env variables from local env
┌────────┬─────┐
│ OLDPWD │ N/A │
└────────┴─────┘
Add your own code metrics: http://bit.ly/code-metrics
Use `pm2 logs verdaccio [--lines 1000]` to display logs
Use `pm2 env 0` to display environement variables
Use `pm2 monit` to monitor CPU and Memory usage verdaccio
複製代碼
npm adduser --registry http://localhost:4873/
npm publish --registry http://localhost:4873/
複製代碼
npm install -g nrm
nrm add verdaccio http://172.24.108.167:4873 //添加一個名爲verdaccio的地址
nrm ls //查看地址
nrm use +name //切換地址
npm install ....
複製代碼
輸入如下命令,能夠看到有兩個文件,一個目錄,config.yaml 用於存放服務配置文檔,htpasswd存放帳戶信息,storage目錄存放發佈上來的包spa
chenpan@chenpandeMacBook-Pro ~ $HOME/.config/verdaccio
chenpan@chenpandeMacBook-Pro ~/.config/verdaccio ll
total 16
-rw-r--r-- 1 chenpan staff 2.2K 6 11 10:43 config.yaml
-rw-r--r-- 1 chenpan staff 60B 6 10 11:11 htpasswd
drwxr-xr-x 4 chenpan staff 128B 6 11 10:39 storage
複製代碼