Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

npm-login

Give credentials to npm login command line

September 1, 2023 by Tarik

I found an npm package for this: Install npm-cli-login and in the terminal/scripts use it as below: npm-cli-login -u testUser -p testPass -e test@example.com I found two other ways to pass the credentials without the need to use an external command, but be aware that these commands might not work in environments such as Jenkins. … Read more

Categories shell Tags command-line, npm, npm-login, shell, terminal Leave a comment

Installing packages from github npm registry – auth error 401

February 26, 2023 by Tarik

You need to generate a personal access token on Github and add it to your npm config in addition to setting the registry in the npm config: In Github navigate to https://github.com/settings/tokens (Settings > Developer settings > Personal access tokens) and you should see something like this: Click Generate new token From the permissions select … Read more

Categories github Tags github, npm, npm-install, npm-login Leave a comment

How to set npm credentials using `npm login` without reading from stdin?

January 21, 2023 by Tarik

TL;DR: Make an HTTP request directly to the registry: TOKEN=$(curl -s \ -H “Accept: application/json” \ -H “Content-Type:application/json” \ -X PUT –data ‘{“name”: “username_here”, “password”: “password_here”}’ \ http://your_registry/-/user/org.couchdb.user:username_here 2>&1 | grep -Po \ ‘(?<=”token”: “)[^”]*’) npm set registry “http://your_registry” npm set //your_registry/:_authToken $TOKEN Rationale Behind the scenes npm adduser makes an HTTP request to the … Read more

Categories node.js Tags docker, node.js, npm, npm-login, npm-publish Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa