I'm trying to use the new private NPM registry feature in Pipelines.
The docs show how to create the package in the repository and publish the package from the repository's Pipelines using .npmrc with $BITBUCKET_PACKAGES_USERNAME and $ENCODED_PACKAGES_TOKEN. This all works.
Next, how do I install that package from a Pipeline in another repository? If I setup a Pipeline with a .npmrc using that repository's $BITBUCKET_PACKAGES_USERNAME and $ENCODED_PACKAGES_TOKEN, it doesnt work:
npm error code E404npm error 404 Not Found - GET https://npm.apkg.io/workspace/@scope%2fpackage - package @scope/package does not exist or you may not have sufficient permission.npm error 404npm error 404 '@scope/package@^1.0.10' is not in this registry.Admittedly, this matches the documentation: the token is scoped to the current repository, not the repository where the package was published. But is there another way to install a package from a private Bitbucket Packages NPM registry in a Bitbucket Pipeline of another repository without configuring a personal token?
You will need to create and use a personal API token to access the registry. If you use this token instead of the $ENCODED_PACKAGES_TOKEN - you can work with any package that's in the workspace vs just the repository-scoped packages:
For now, you'll need to use an Atlassian API token (ideally from a service account) as a secured variable, because the built-in Pipeline tokens won't work cross-repo. There is a workspace-accessible packages feature which is currently in the works, so this is a workaround until this is implemented.
Hope this helps, please let me know if you have any further questions.
Cheers!
- Ben (Bitbucket Cloud Support)
Thanks Ben, personal API token works for now. I'm eagerly awaiting the workspace-accessible packages feature.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.