Skip to content

npm-cli-login does not pick up my environment variables #57

@maudzekod4000

Description

@maudzekod4000

Hi, everyone!
I am on MacOS 10.15.7, having node 15 and npm 7.

I installed npm-cli-login specifically for the purpose of being able to login with env. variables.
So I did everything as in the docs - installed the library globally, then added the environment variables with the names they should be in my .bash_profile file.
When I executed the npm-cli-login command I get the following:

node:assert:385
    throw err;
    ^

AssertionError [ERR_ASSERTION]: must include username in auth
    at RegClient.adduser (/usr/local/lib/node_modules/npm-cli-login/node_modules/npm-registry-client/lib/adduser.js:16:3)
    at Object.login (/usr/local/lib/node_modules/npm-cli-login/lib/login.js:51:16)
    at module.exports (/usr/local/lib/node_modules/npm-cli-login/lib/index.js:9:9)
    at login (/usr/local/lib/node_modules/npm-cli-login/bin/npm-cli-login.js:30:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm-cli-login/bin/npm-cli-login.js:33:1)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

I ended up running the command like the following:
NPM_USER=$NPM_USER NPM_PASS=$NPM_PASS NPM_EMAIL=$NPM_EMAIL NPM_REGISTRY=$NPM_REGISTRY npm-cli-login

Perhaps it is not a problem in the library, but in how I use it.
Could you help me figure this out?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions