1

I am trying to publish a really simple example to our gitlab npm registry but getting an error

I have updated the names/projectId/token etc but this is the error.

npm ERR! 422 Unprocessable Entity - PUT https://gitlab.com/my-company/api/v4/projects/1234567/packages/npm/@mycompany2fmy-test-repo

here is my .npmrc file

@mycompany:registry=https://gitlab.com/my-company/api/v4/packages/npm/

//gitlab.com/my-company/api/v4/packages/npm/:_authToken=<<TOKEN HERE...>>

//gitlab.com/my-company/api/v4/projects/1234567/packages/npm/:_authToken=<<TOKEN HERE...>>

in my package.json

{
  "name": "@mycompany/my-test-repo",
  ...
  "publishConfig": {
    "@mycompany:registry": "https://gitlab.com/my-company/api/v4/projects/1234567/packages/npm/"
  }

Any idea what it could be?

I've tried creating two different access tokens, neither has worked, I tried a personal access token as well as a deploy access token.

Anyone that can help i'd really apprecite it.

user3284707
  • 3,033
  • 3
  • 35
  • 69

1 Answers1

1

After many attempts I finally got this working.

package.json

{
  "name": "@myorg/my-repository",

  ...

  "publishConfig": {
    "@myorg:registry": "https://gitlab.com/api/v4/projects/12345678/packages/npm/"
  }
}

.npmrc file

@myorg:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=[[MY_ACCESS_TOKEN]]
//gitlab.com/api/v4/projects/12345678/packages/npm/:_authToken=[[MY_ACCESS_TOKEN]]
user3284707
  • 3,033
  • 3
  • 35
  • 69