Hi all,
I can’t succeed to get a private package repository successfuly pushed on Github registry and I don’t succeed to find the reason. It seems to be link to authentication and the use of yarn but not sure why.
The package is build and published using Github Actions with the following config:
name: Build new version package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '11.9.0'
scope: '@jonlev'
- name: 'Install dependecies'
uses: Borales/actions-yarn@v2.1.0
with:
cmd: install
- name: 'Build package'
uses: Borales/actions-yarn@v2.1.0
with:
cmd: build
- name: 'Publish package'
uses: Borales/actions-yarn@v2.1.0
with:
cmd: publish
registry-url: https://npm.pkg.github.com/
auth-token: ${{secrets.GITHUB_TOKEN}}
In the repo that need to use it I set a .npmrc like said in the official documentation
{repo}/.npmrc
registry=https://npm.pkg.github.com/
~/.npmrc
//npm.pkg.github.com/:_authToken={PERSONAL_TOKEN}
then yarn add @organisation/package --verbose
log
yarn add @destygo/components-library --verbose
yarn add v1.21.1
verbose 0.361 Checking for configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.362 Found configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.362 Checking for configuration file "/Users/jonas/.npmrc".
verbose 0.362 Found configuration file "/Users/jonas/.npmrc".
verbose 0.363 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.364 Checking for configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.365 Found configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.365 Checking for configuration file "/Users/jonas/destygo/.npmrc".
verbose 0.366 Checking for configuration file "/Users/jonas/.npmrc".
verbose 0.366 Found configuration file "/Users/jonas/.npmrc".
verbose 0.366 Checking for configuration file "/Users/.npmrc".
verbose 0.369 Checking for configuration file "/Users/jonas/destygo/IRIS/.yarnrc".
verbose 0.369 Checking for configuration file "/Users/jonas/.yarnrc".
verbose 0.369 Found configuration file "/Users/jonas/.yarnrc".
verbose 0.369 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.369 Checking for configuration file "/Users/jonas/destygo/IRIS/.yarnrc".
verbose 0.37 Checking for configuration file "/Users/jonas/destygo/.yarnrc".
verbose 0.37 Checking for configuration file "/Users/jonas/.yarnrc".
verbose 0.37 Found configuration file "/Users/jonas/.yarnrc".
verbose 0.37 Checking for configuration file "/Users/.yarnrc".
verbose 0.375 current time: 2020-01-15T14:04:39.653Z
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
verbose 1.688 Performing "GET" request to "https://npm.pkg.github.com/@destygo%2fcomponents-library".
verbose 2.516 Request "https://npm.pkg.github.com/@destygo%2fcomponents-library" finished with status code 200.
======= resolving dependencies packages ====
[3/5] 🚚 Fetching packages...
======= fetching dependencies packages =====
verbose 25.15 Performing "GET" request to "https://npm.pkg.github.com/download/@destygo/components-library/1.18.6/f6e1454093e83088aaf2e48fc11a81f23f45b05fd7dfc9857861683be3d02a66".
verbose 25.405 Error: https://npm.pkg.github.com/download/@destygo/components-library/1.18.6/f6e1454093e83088aaf2e48fc11a81f23f45b05fd7dfc9857861683be3d02a66: Request failed "401 Unauthorized"
at ResponseError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:696:66)
at new ResponseError (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:802:124)
at Request.<anonymous> (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:67017:16)
at Request.emit (events.js:197:13)
at Request.module.exports.Request.onRequestResponse (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:141542:10)
at ClientRequest.emit (events.js:202:15)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:560:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:113:17)
at TLSSocket.socketOnData (_http_client.js:447:20)
at TLSSocket.emit (events.js:197:13)
error An unexpected error occurred: "https://npm.pkg.github.com/download/@destygo/components-library/1.18.6/f6e1454093e83088aaf2e48fc11a81f23f45b05fd7dfc9857861683be3d02a66: Request failed \"401 Unauthorized\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/jonas/destygo/IRIS/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
If I use the owner in repo url, it just stop at resolution
{repo}/.npmrc
registry=https://npm.pkg.github.com/Organisation
then yarn add @organisation/package --verbose
log
yarn add @destygo/components-library --verbose
yarn add v1.21.1
verbose 0.981 Checking for configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.982 Found configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.982 Checking for configuration file "/Users/jonas/.npmrc".
verbose 0.982 Found configuration file "/Users/jonas/.npmrc".
verbose 0.982 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.983 Checking for configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.983 Found configuration file "/Users/jonas/destygo/IRIS/.npmrc".
verbose 0.983 Checking for configuration file "/Users/jonas/destygo/.npmrc".
verbose 0.983 Checking for configuration file "/Users/jonas/.npmrc".
verbose 0.983 Found configuration file "/Users/jonas/.npmrc".
verbose 0.983 Checking for configuration file "/Users/.npmrc".
verbose 0.986 Checking for configuration file "/Users/jonas/destygo/IRIS/.yarnrc".
verbose 0.987 Checking for configuration file "/Users/jonas/.yarnrc".
verbose 0.987 Found configuration file "/Users/jonas/.yarnrc".
verbose 0.987 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.987 Checking for configuration file "/Users/jonas/destygo/IRIS/.yarnrc".
verbose 0.987 Checking for configuration file "/Users/jonas/destygo/.yarnrc".
verbose 0.987 Checking for configuration file "/Users/jonas/.yarnrc".
verbose 0.987 Found configuration file "/Users/jonas/.yarnrc".
verbose 0.988 Checking for configuration file "/Users/.yarnrc".
verbose 0.992 current time: 2020-01-15T14:36:30.943Z
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
verbose 1.892 Performing "GET" request to "https://npm.pkg.github.com/Destygo/@destygo%2fcomponents-library".
verbose 2.331 Request "https://npm.pkg.github.com/Destygo/@destygo%2fcomponents-library" finished with status code 401.
verbose 2.342 Error: Couldn't find package "@destygo/components-library" on the "npm" registry.
at MessageError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:721:66)
at new MessageError (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:750:123)
at NpmResolver.<anonymous> (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:50683:15)
at Generator.next (<anonymous>)
at step (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:310:30)
at /usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:321:13
at processTicksAndRejections (internal/process/next_tick.js:81:5)
error Couldn't find package "@destygo/components-library" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Though publish seems good
I look in yarn issues and github community thread and solutions there did not worked for me.
last information, it works with npm install
but my company want to stick to yarn for now.
Any idea how to solve this ?