修复 Nexus 中损坏的 NPM 数据库?

Fix a corrupted NPM database in Nexus?

我们的 Nexus 服务器已满磁盘,当我们重新启动它时出现以下错误:

jvm 1    | 2015-08-18 09:44:13,660+1000 ERROR [jetty-main-1] *SYSTEM com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore - Life-cycle operation failed
jvm 1    | com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/nexus/db/npm' with mode=rw
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:220) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:244) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      at com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore.doStart(OrientMetadataStore.java:107) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70) ~[goodies-lifecycle-1.9.jar:1.9]
jvm 1    |      at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255) ~[goodies-lifecycle-1.9.jar:1.9]
jvm 1    |      at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57) ~[goodies-lifecycle-1.9.jar:1.9]
jvm 1    |      at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129) ~[goodies-lifecycle-1.9.jar:1.9]
jvm 1    |      at com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStoreLifecycle.on(OrientMetadataStoreLifecycle.java:51) [nexus-npm-repository-plugin-2.11.3-01/:na]


jvm 1    | Caused by: com.orientechnologies.orient.core.exception.OStorageException: File with name internal.pcl does not exist in storage npm
jvm 1    |      at com.orientechnologies.orient.core.index.hashindex.local.cache.OWOWCache.openFile(OWOWCache.java:249) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      at com.orientechnologies.orient.core.index.hashindex.local.cache.OReadWriteDiskCache.openFile(OReadWriteDiskCache.java:159) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent.openFile(ODurableComponent.java:145) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.open(OPaginatedCluster.java:203) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:190) ~[nexus-npm-repository-plugin-2.11.3-01/:na]
jvm 1    |      ... 61 common frames omitted

我该如何解决这个问题?

我找不到关于此错误的任何信息,因为它与 Nexus 具体相关,所以我想我会分享我的解决方案。

首先,您需要关闭 Nexus 并删除 /db/npm 目录。然后启动 Nexus 和 运行 重建托管的 npm 元数据任务。这解决了我的问题。