如何在 Nexus 中为 NPM 存储库重建索引?
How to rebuild index for NPM repositories in Nexus?
我们在 64 位 RHEL6 上有一个 Nexus 2.11.4-01 PRO 运行 实例,它托管了多种类型的存储库。最近,所有 NPM 存储库都以某种方式损坏,任何在 Windows 上使用 npm 发布 NPM 包的尝试都会失败,并出现以下错误:
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! publish Failed PUT 500
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\Programs\nodejs-0.12.7\\node.exe" "D:\Programs\nodejs-0.12.7\node_modules\npm\bin\npm-cli.js" "publish"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Unexpected token <
npm ERR! <html>
npm ERR! <head>
npm ERR! <title>500 - We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.</title>
npm ERR! <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
npm ERR!
npm ERR! <link rel="icon" type="image/png" href="http://nexus:8081/nexus/favicon.png">
npm ERR! <!--[if IE]>
npm ERR! <link rel="SHORTCUT ICON" href="http://nexus:8081/nexus/favicon.ico"/>
npm ERR! <![endif]-->
npm ERR!
npm ERR! <link rel="stylesheet" href="http://nexus:8081/nexus/static/css/Sonatype-content.css?2.11.4-01" type="text/css" media="screen" title="no title" charset="utf-8">
npm ERR! </head>
npm ERR! <body>
npm ERR! <h1>500 - We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.</h1>
npm ERR! <p>We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.</p>
npm ERR! </body>
npm ERR! </html>
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! D:\somewhere\npm-debug.log
如日志所示,
We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.
但我找不到如何重建该索引。我尝试 "Repair Index"、"Update Index",甚至从管理员 UI 到 "Expire Cache",而应用程序 "In Service" 和 "Out of Service" 都没有成功。
有什么想法吗?
我向支持团队询问了这个问题,他们回答(相当快,大约 10 分钟)如下:
To rebuild the index for npm:
- Shut down nexus
- Remove the contents of sonatype-work/nexus/db/npm
- Restart
- Schedule "Rebuild hosted npm metadata" tasks to run against your hosted npm repositories
You don't need to do anything for proxy or group npm repositories,
these will just work after restart.
然后它就正常工作了。
PS: 无从属关系或任何关系。
我们在 64 位 RHEL6 上有一个 Nexus 2.11.4-01 PRO 运行 实例,它托管了多种类型的存储库。最近,所有 NPM 存储库都以某种方式损坏,任何在 Windows 上使用 npm 发布 NPM 包的尝试都会失败,并出现以下错误:
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! publish Failed PUT 500
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\Programs\nodejs-0.12.7\\node.exe" "D:\Programs\nodejs-0.12.7\node_modules\npm\bin\npm-cli.js" "publish"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Unexpected token <
npm ERR! <html>
npm ERR! <head>
npm ERR! <title>500 - We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.</title>
npm ERR! <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
npm ERR!
npm ERR! <link rel="icon" type="image/png" href="http://nexus:8081/nexus/favicon.png">
npm ERR! <!--[if IE]>
npm ERR! <link rel="SHORTCUT ICON" href="http://nexus:8081/nexus/favicon.ico"/>
npm ERR! <![endif]-->
npm ERR!
npm ERR! <link rel="stylesheet" href="http://nexus:8081/nexus/static/css/Sonatype-content.css?2.11.4-01" type="text/css" media="screen" title="no title" charset="utf-8">
npm ERR! </head>
npm ERR! <body>
npm ERR! <h1>500 - We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.</h1>
npm ERR! <p>We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.</p>
npm ERR! </body>
npm ERR! </html>
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! D:\somewhere\npm-debug.log
如日志所示,
We reached max level of depth of SBTree but still found nothing, seems like tree is in corrupted state. You should rebuild index related to given query.
但我找不到如何重建该索引。我尝试 "Repair Index"、"Update Index",甚至从管理员 UI 到 "Expire Cache",而应用程序 "In Service" 和 "Out of Service" 都没有成功。
有什么想法吗?
我向支持团队询问了这个问题,他们回答(相当快,大约 10 分钟)如下:
To rebuild the index for npm:
- Shut down nexus
- Remove the contents of sonatype-work/nexus/db/npm
- Restart
- Schedule "Rebuild hosted npm metadata" tasks to run against your hosted npm repositories
You don't need to do anything for proxy or group npm repositories, these will just work after restart.
然后它就正常工作了。
PS: 无从属关系或任何关系。