Reputation: 71
I'd make my first npm publish
into my Gitlab project. The project is private so I generated a deploy token with read
& write
permission for package registry.
Locally I created an .npmrc file and used these lines:
@laszlo-bottlik:registry=https://gitlab.com/api/v4/projects/28303714/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken='<deploy-name>:<deploy-password>'
//gitlab.com/api/v4/projects/28303714/packages/npm/:_authToken='<deploy-name>:<deploy-password>'
Name value in package json is @laszlo-bottlik/playground
Url for the project is https://gitlab.com/laszlo-bottlik/playground
When I run npm publish
command in terminal then I get 401 error:
HttpErrorGeneral: 401 Unauthorized - PUT https://gitlab.com/api/v4/projects/28303714/packages/npm/@laszlo-bottlik%2fplayground
Any kind of help can lead me to the solution.
What should I check in my local environment?
What should I check in my project settings under Gitlab?
Upvotes: 0
Views: 1388
Reputation: 3230
Is there a reason you're using a deploy token as opposed to a job token? Either way, it looks like you may have an extra variable in your authToken argument above - You have <deploy-name>:<deploy-password>
in your example code, but GitLab's code only shows a single auth_token argument (reference):
npm config set -- '//gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken' "<your_token>"
Upvotes: 0