- Newest
- Most votes
- Most comments
I was able to get Yarn 2 working with AWS CodeArtifact.
Go here to instructions how to install Yarn 2. https://yarnpkg.com/getting-started/install
First I created a script that exports a variable with the CodeArtifact token.
export CODEARTIFACT_AUTH_TOKEN=aws codeartifact get-authorization-token --domain artifact-domain --domain-owner 123456789012 --query authorizationToken --output text
I created a file in the root of the repo .yarnrc.yml with the following:
yarnPath: ".yarn/releases/yarn-berry.cjs"
nodeLinker: "node-modules"
npmRegistryServer: "https://artifact-domain-123456789012.d.codeartifact.us-east-1.amazonaws.com/npm/npm-repo/"
npmAlwaysAuth: true
npmAuthToken: ${CODEARTIFACT_AUTH_TOKEN}
So now when I do yarn install it authenticates correctly against CodeArtifact.
Thanks for posting this answer. We'll get the CodeArtifact User Guide updated with instructions for Yarn 2.
- Carl.
Relevant content
- Accepted Answerasked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 years ago