1

从今天开始,verdaccio (v3.8.3) 停止在本地注册表中显示包。

在浏览器上打开显示此消息:尚未发布包

配置中指定的存储文件夹(~/.local/share/verdaccio/storage)包含我所有的包。

但是数据库文件是空的~/.local/share/verdaccio/storage/.sinopia-db.json。确实从终端运行 verdaccio 我得到了这个:

 warn --- config file  - /home/bssadmin/.config/verdaccio/config.yaml
 error--- Package database file corrupted (invalid JSON), please check the error printed below.
File Path: /home/bssadmin/.local/share/verdaccio/storage/.sinopia-db.json SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at LocalDatabase._parseDatabase (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/node_modules/@verdaccio/local-storage/lib/local-database.js:298:19)
    at LocalDatabase._fetchLocalPackages (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/node_modules/@verdaccio/local-storage/lib/local-database.js:272:23)
    at new LocalDatabase (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/node_modules/@verdaccio/local-storage/lib/local-database.js:49:22)
    at LocalStorage._loadStorage (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/lib/local-storage.js:809:14)
    at new LocalStorage (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/lib/local-storage.js:54:27)
    at Storage.init (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/lib/storage.js:64:25)
    at /home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/api/index.js:145:19
    at Generator.next (<anonymous>)
    at step (/home/bssadmin/.npm-packages/lib/node_modules/verdaccio/build/api/index.js:53:191)
 error--- Database is locked, please check error message printed during startup to prevent data loss.
(node:9242) ExperimentalWarning: The fs.promises API is experimental
 error--- Database is locked, please check error message printed during startup to prevent data loss.
 warn --- Plugin successfully loaded: htpasswd
 warn --- Plugin successfully loaded: audit
 warn --- http address - http://0.0.0.0:4873/ - verdaccio/3.8.3

发生了什么?我该如何解决?

我应该用“verdaccio”标签标记这个问题,但它不可用,我无法创建它。

4

1 回答 1

1

如果.sinopia-db.json.为空,则很可能已损坏。如果有任何私有包,您可能需要手动修复它。

格式很简单

{"list":["@test/test_1","@test/test_2","@test/test_3","test_4"],"secret":"secretKEYLongString"}

此文件必须是有效的 JSON 格式。

如果在另一个有,数据库是空的,只是让列表数组为空,或者删除整个文件,重新启动服务器,Verdaccio 将生成一个新的。

于 2019-04-06T13:21:26.027 回答