typescriptnpmaws-codeartifact

How to install package uploaded to CodeArtifact?


I just created an npm package (using typescript and node18 ) and uploaded it to Code Artifact.

As stated in this document I used the following command to install the package

aws codeartifact login --tool npm --repository repoName --domain domainName --domain-owner <Domain owner ID>

Instead I got .npmrc file and still can't use my package.

Any explanation why I'm still unable to use package or how can I do so?

Note: the domain name nor the repo are scoped


Solution

  • You need to set the registry as codeArtifact. If you don't set the registry, your package will get installed from npm registry.

    Try this command after running your login command:

    npm config set registry https://{domain-name}-{accountId}.d.codeartifact.region.amazonaws.com/npm/{repoName}/