首页 > 解决方案 > npm 包元数据 api

问题描述

npm 说我们可以通过下面提供的公共 api 获取包的元数据

https://github.com/npm/registry/blob/master/docs/REPLICATE-API.md#get

https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-all

但是当我们从外部 Web 应用程序(假设 localhost)调用 api 时,它们似乎都不起作用。它给出了 cors 错误。

只有搜索 api 似乎是公开的

https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search

谁能帮我找到公共 api,我们可以从中检索包的元数据。没有给出cors错误。

我也使用了下面列出的技术。但是当我们尝试从外部应用程序调用时,它们似乎都不起作用。它给出了 cors 错误 列出 npm 注册表中的所有公共包

标签: node.jsnpmnpm-registry

解决方案


推荐阅读