出于安全原因,我需要一个特定的注册表,但在package-lock.json我仍然保留https://registry.npmjs.org/
有什么办法可以强制吗?
我有一个脚本来验证用户是否通过 grep 登录到私有 npm 注册表(通过“npm login”):
//registry-sub-url:_authToken=
Run Code Online (Sandbox Code Playgroud)
... 在:
~/.npmrc
Run Code Online (Sandbox Code Playgroud)
但是,随着用户凭据过期(由于标准密码过期规则),这会随着时间的推移而失效。
更重要的是,我创建的帮助脚本无法区分成功/失败的npm login调用,因为脚本总是以0状态退出。
问:(1)我们如何验证是否npm login成功?(2) 如何识别npm token何时过期?
我尝试将 Dependabot 与 AWS CodeArtifact 结合使用,但不断遇到身份验证问题。
Dependabot 无法对私有包注册表进行身份验证使用了以下私有包注册表并导致更新失败:###-###.d.codeartifact..amazonaws.com/npm/private。
日志:
代理| 2022/06/29 16:52:05 [022] 获取 https://###-###.d.codeartifact.###.amazonaws.com:443/npm/private/hermes-engine 代理 | 2022/06/29 16:52:06 [022] 401 https://###-###.d.codeartifact.###.amazonaws.com:443/npm/private/hermes-engine 代理 | 2022/06/29 16:52:06 [024] 获取 https://###-###.d.codeartifact.###.amazonaws.com:443/npm/private/hermes-engine 代理 | 2022/06/29 16:52:06 [024] 401 https://###-###.d.codeartifact.###.amazonaws.com:443/npm/private/hermes-engine 更新程序 | 信息 <job_408163671> 更新 Hermes-engine 时处理错误:private_source_authentication_failure {:source=>"###-###.d.codeartifact.###.amazonaws.com/npm/private"}
我尝试过使用不同的dependabot.yml配置,例如带有路径的完整 CodeArtifact URL 或使用token而不是用户名和密码。
我的dependabot.yml:
version: 2
registries:
npm-codeartifact:
type: npm-registry
url: https://<registry>-<account>.d.codeartifact.<region>.amazonaws.com
username: aws
password: ${{secrets.CODEARTIFACT_TOKEN}}
- package-ecosystem: "npm"
schedule:
interval: "daily"
registries:
- npm-codeartifact
Run Code Online (Sandbox Code Playgroud)
我应该使用什么来使 dependentabot 与 CodeArtifact …
对于所有其他 stackoverflow 问题,人们似乎都在询问私有 npm git 存储库或不同的技术堆栈。我很确定我可以在 GAE Flex 中使用私有 npm 注册表,但我想知道标准版本是否可以?
从GAE 标准文档来看,这似乎不可能。还有人想出其他办法吗?
google-app-engine node.js npm-install google-appengine-node npm-registry
这个问题包括一个特定的用例:
@myscope/mypackagehttps://company.jfrog.io/artifactory/api/npm/my-npm-registry/我怎样才能做到这一点?
我同时处理多个项目,不同项目的节点模块注册表不一样。
例如,项目A 的所有模块均来自http://registroy.foo.com,项目B 的模块均来自http://registroy.bar.com
有没有一种方法可以指定我们要用于项目内部package.json文件的注册表,例如source在 Ruby 中的 Gemfile 中定义的内容。
我使用 gitlab 创建了一个私人 npm 注册表
我有以下 .npmrc 文件,该文件与我用来发布的 .npmrc 文件相同,没有任何问题。我已用占位符替换了所有公司值。
@myorg:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=[[MY_TOKEN_HERE]]
//gitlab.com/api/v4/projects/12345678/packages/npm/:_authToken=[[MY_TOKEN_HERE]]
Run Code Online (Sandbox Code Playgroud)
当我去安装时,我收到以下错误消息
npm install @myorg/my-package-name-here
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@myorg/my-package-name-here - Not found
npm ERR! 404
npm ERR! 404 '@myorg/my-package-name-here@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, …Run Code Online (Sandbox Code Playgroud) npm-registry ×7
npm ×4
node.js ×3
npm-install ×2
artifactory ×1
dependabot ×1
gitlab ×1
javascript ×1
scope ×1