Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-cli-login

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-cli-login

Allows you to log in to NPM without STDIN, STDOUT. Use in places like CI build systems. Also creates entries in the ```~/.npmrc``` file for authentication.

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32K
decreased by-53.42%
Maintainers
1
Weekly downloads
 
Created
Source

npm-cli-login

Allows you to log in to NPM without STDIN, STDOUT. Use in places like CI build systems. Also creates entries in the ~/.npmrc file for authentication.

Installation

npm install -g npm-cli-login

Use -g flag to use npm-cli-login via the CLI

Usage

CLI

npm-cli-login expects the following environment variables to be set before you can use it to authenticate:

  • NPM_USER: NPM username
  • NPM_PASS: NPM password
  • NPM_EMAIL: NPM email
  • NPM_REGISTRY: (optional) Private NPM registry to log in to (If not set, public NPM is used, https://registry.npmjs.org)
  • NPM_SCOPE: (optional) Private NPM scope

Once the required ones are set, you can just run the following to log in:

npm-cli-login

You can also export variables and run it all in one line:

NPM_USER=testUser NPM_PASS=testPass NPM_EMAIL=test@example.com npm-cli-login

Programmatic

To use the package programmatically, just require the module and pass in your NPM auth details as arguments:

var npmLogin = require('npm-cli-login');

npmLogin(username, password, email [, registry, scope]);
Example

Logging in to the NPM registry:

var npmLogin = require('npm-cli-login'),
    username = 'testUser',
    password = 'testPass',
    email = 'test@example.com'

npmLogin(username, password, email)

Logging in to private NPM registries:

var npmLogin = require('npm-cli-login'),
    username = 'testUser',
    password = 'testPass',
    email = 'test@example.com',
    registry = 'https://npm.example.com',
    scope = '@myScope'

npmLogin(username, password, email, registry, scope)

FAQs

Package last updated on 16 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc