简体   繁体   English

从 npmjs 用户获取所有私有 npm 模块

[英]Fetching all private npm modules from an npmjs user

I'm working on a task to migrate all of our npm modules from npmjs.com.我正在执行一项任务,以从 npmjs.com 迁移我们所有的 npm 模块。 Problem is, all of our modules are stored under an npm user as private packages, and I can't find a way to consume all packages the user owns programmatically.问题是,我们所有的模块都作为私有包存储在 npm 用户下,我找不到以编程方式使用用户拥有的所有包的方法。

I found many examples that explain how to migrate a single package or a list of packages by name, but I've yet to understand how can I fetch every package a user owns to create that list.我找到了许多示例来解释如何迁移单个 package 或按名称列出的包列表,但我还没有理解如何获取用户拥有的每个 package 来创建该列表。

There are a few modules that allow interacting with the NPM registry API, but I couldn't find out how to make them consume private scoped packages.有一些模块允许与 NPM 注册表 API 进行交互,但我不知道如何让它们使用私有作用域包。 I'm currently working with the npm-registry-fetch to try and get an example query working with no luck.我目前正在使用npm-registry-fetch来尝试获取示例查询,但没有成功。
This is the code I'm trying to run -这是我要运行的代码 -

var npmFetch = require('npm-registry-fetch')


async function run() {
  var response = await npmFetch.json('@<scope redacted>/<package name redacted>',{token: '<token redacted>'})
}

run()

This code results in this error -此代码导致此错误 -
HttpErrorGeneral: 404 Not Found - GET https://registry.npmjs.org/@<scope redacted>/<package name redacted> - Not found

How can I successfully query these type of packages?如何成功查询这些类型的包?
Thanks.谢谢。

Updating that this SO answer gave me the tools I've needed, performing the request as a curl command worked, so I'll just use that instead of using fancy registry clients.更新这个SO答案给了我我需要的工具,在 curl 命令有效时执行请求,所以我将只使用它而不是使用花哨的注册表客户端。 Thanks again internet stranger!再次感谢互联网陌生人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM