问题标签 [npm-registry]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
134 浏览

npm - 如何从不同的注册表安装范围包( package.json setup )

所以我的 package.json 中有这个包 "reusable-components": "^1.0.1" 如果我​​点击 npm install,它会尝试从https://registry/npmjs.org下载它 如果我手动尝试使用 npm install reusable-components --registry= http://xx.xxx.xx.xxx:xxxxx,它将尝试从我打算仅用于该软件包的注册表中安装它

我的尝试是制作一个作用域包,因此我在项目的根目录中制作了一个 .npmrc 文件,其中包含以下内容:

在此之后,我用 "@verdaccio/reusable-components": "^1.0.1" 重写了 package.json。根据官方 npm 文档,这应该可以工作,但是,在控制台中点击 npm install 并不能正确地尝试从我为该范围设置的注册表中获取可重用组件。

感谢您的时间。

0 投票
0 回答
47 浏览

npm - npm 注册表,是否可以将 Java 或 C# 库发布到 npm 注册表中

npm 注册表,是否可以将 Java 或 C# 库发布到 npm 注册表中。

如果是这样,请推荐一些有关如何创建私有 npm 注册表的文章或详细信息。

提前致谢

0 投票
0 回答
408 浏览

node.js - 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 注册表中的所有公共包

0 投票
1 回答
2287 浏览

node.js - 覆盖 package-lock.json 中已安装包的注册表

我有一个庞大的、现有的package-lock.json和许多已通过http://registry.npmjs.org/解决的依赖项。

例如

我将注册表配置为 NPM Enterprise 安装,它托管专有 NPM 包并镜像公共 NPM 注册表。

这适用于新安装的包,但许多现有包仍然指向公共 NPM 注册表。npm i我尝试使用or覆盖 package-lock.json npm i --package-lock-only

如何强制 NPM 使用我的 Enterprise NPM 注册表并将正确的resolvedURL 写入到package-lock.json?我可能只是“查找和替换”,但我想确保 NPM 正确解决依赖关系。

0 投票
0 回答
517 浏览

npm - private nexus npm proxy registry and tarball location

We are using Nexus as our artifact repository in a corporate build environment. We have proxy repositories/registries configured for things like maven, nuget, and npm. Our jenkins build servers only have access to our local intranet, so they pull artifacts through the Nexus proxy repos. This works great for maven and nuget, but when it comes to npm I'm running into an issue.

.npmrc contains:

My package.json file contains:

When npm install --verbose is run from the build server, I get:

There is a lot more output prior to this and I'd be happy to provide it if necessary. The color-name package, as pulled from https://nexus.local/nexus/repository/npm-official/color-name/1.1.3 contains:

That hardcoded tarball location is used to fetch the archive, and as you can see from logs above, it fails to retrieve it because this build server only has local intranet access. If I manually visit https://nexus.local/nexus/repository/npm-official/color-name/-/color-name-1.1.3.tgz in a browser, the archive is downloaded successfully.

So the npm proxy registry is working, but it seems that the tarball location is the problem. Is it possible to pull the tarball from my proxy repo? Am I missing some setting/configuration option that would cause those tarball locations to use a location relative to my defined proxy registry? It looks like more than 1 dependency of eslint is having this issue. It's not specific to just color-name.

0 投票
1 回答
1035 浏览

azure-devops - 如何验证azure devops管道,使管道可以成功恢复yarn包

我的应用程序使用身份验证后安装在本地的纱线包。注册表 url 在 .npmrc 文件中指定。现在我的构建管道失败,并显示“包还原失败”(请求失败“401 未授权”)。如何验证 azure devops 构建管道?

我尝试在我的 YML 文件中添加一个任务,如下所示,在其中指定 npmrc 路径,以便它从管道进程静默身份验证,但这不起作用

有没有不同的方法来实现这一目标?

0 投票
1 回答
294 浏览

npm - npmjs 复制和 npmjs 注册表之间的区别

出于研究目的,我有兴趣获取 npm 包名称的完整列表。一些现有的答案指向https://replicate.npmjs.com/registry/_all_docs,但 url 是replicate.npmjs.com,而且它似乎是一个不同于http://registry.npmjs.com/. 例如,截至目前,http: //registry.npmjs.com/doc_count是 1844996,但https://replicate.npmjs.com/是 1419077。

registry.npmjs.com和 和有什么不一样replicate.npmjs.com?它们是相同的还是不同的注册表?它们是用来做什么的?哪一个是 npm CLI 使用的“默认”?

0 投票
0 回答
68 浏览

npm - VSCode 在 package.json 中显示错误的 npm 包信息

当使用智能感知package.json信息时,那里的信息是旧的/不正确的。例如,现在它说最新版本@angular/core实际上10.1.3应该是10.2.0https ://www.npmjs.com/package/@angular/core

这是一个错误,还是有一个设置来清除缓存或解决这个问题?

VS代码

0 投票
2 回答
691 浏览

reactjs - npx create-react-app projectName 导致错误

我正在使用第一个命令创建一个反应应用程序;npm init然后是第二个npx create-react-app projectName,但是它给出了这个错误:

我的 npm 配置列表如下

调试日志文件

0 投票
0 回答
56 浏览

npm - 强制 npm 仅使用私有注册表

我们正在使用带有私有注册表的 npm。

我知道可以通过以下方式使用私有注册表:

  • 将其包含在 .nmprc 文件中(registry=[registry])
  • 作为参数通过 cli 通过“npm install --registry==[registry]

如果通过私有注册表解决依赖关系失败,npm 将使用中央工件 ( https://registry.npmjs.org/ )。我想抑制这种行为,只允许私有注册表。如果依赖项不在私有注册表中,它应该会失败并且不要使用回退。这可能吗?