Amazon web services NPM总是使用AWS代码工件
我在本地机器上有一些不同的项目。然后,其中一些使用AWS Codeartifact下载AWS Codeartifact中的私有依赖项,而另一些则不使用。使用AWS Codeartifact的项目使用Thread管理它们的依赖关系,而我的项目不使用AWS Codeartifact的项目使用NPM管理它们的依赖关系 当我在NPM中运行一个简单的命令时,如:Amazon web services NPM总是使用AWS代码工件,amazon-web-services,npm,yarnpkg,aws-codeartifact,Amazon Web Services,Npm,Yarnpkg,Aws Codeartifact,我在本地机器上有一些不同的项目。然后,其中一些使用AWS Codeartifact下载AWS Codeartifact中的私有依赖项,而另一些则不使用。使用AWS Codeartifact的项目使用Thread管理它们的依赖关系,而我的项目不使用AWS Codeartifact的项目使用NPM管理它们的依赖关系 当我在NPM中运行一个简单的命令时,如: npm install nanoid npm试图连接到我的AWS Codeartifact,但出现错误: Unable to authenti
npm install nanoid
npm试图连接到我的AWS Codeartifact,但出现错误:
Unable to authenticate, need: Bearer realm="domain-npm-repo/npm-repo", Basic realm="domain-npm-repo/npm-repo"
如何将我的机器配置为仅对我想要的项目使用AWS代码
其他配置:
我的机器是Windows 10,我已使用凭据全局安装了aws sdk。我通过以下命令解决了此问题:
npm config set registry https://registry.npmjs.org/
它将我的npm注册表设置回默认值,并使用npm注册表而不是aws codeartifact注册表。我通过以下命令解决了它:
npm config set registry https://registry.npmjs.org/
它将我的npm注册表设置回默认值,并使用npm注册表而不是aws codeartifact注册表。假设您使用的是
aws codeartifact登录--tool npm--repository my repo--domain my domain
要登录aws,您应该使用更精细的方法使用以下命令:
# get endpoint
endpoint = aws codeartifact get-repository-endpoint --domain my_domain --domain-owner 111122223333 --repository my_repo --format npm
# set a scoped registry
npm config set registry endpoint --scope=@my-package <- this is what you want
# get token
token = aws codeartifact get-authorization-token --domain my_domain --domain-owner 111122223333 --repository my_repo
# set token
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:_authToken=token
# always truth
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:always-auth=true
#获取端点
endpoint=aws codeartifact获取存储库端点--域my_域--域所有者111122223333--存储库my_repo--格式npm
#设置作用域注册表
npm config set registry endpoint--scope=@my package假设您正在使用aws codeartifact登录--工具npm--存储库my repo--域my domain
登录aws,您应该使用更精细的方法使用以下命令:
# get endpoint
endpoint = aws codeartifact get-repository-endpoint --domain my_domain --domain-owner 111122223333 --repository my_repo --format npm
# set a scoped registry
npm config set registry endpoint --scope=@my-package <- this is what you want
# get token
token = aws codeartifact get-authorization-token --domain my_domain --domain-owner 111122223333 --repository my_repo
# set token
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:_authToken=token
# always truth
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:always-auth=true
#获取端点
endpoint=aws codeartifact获取存储库端点--域my_域--域所有者111122223333--存储库my_repo--格式npm
#设置作用域注册表
npm config set registry endpoint--scope=@my package文档AWS链接:谢谢您的回答!它起了很大的作用,而且确实更细粒度。谢谢文档AWS链接:谢谢你的回答!它起了很大的作用,而且确实更细粒度。谢谢