Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm token list giving error

Tags:

node.js

npm

I just upgraded the npm using:

npm install npm@latest -g

When I do npm token list now, I get following error:

npm ERR! code EAUTHIP

npm ERR! Unable to authenticate, need: Basic, Bearer

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/USerName/.npm/_logs/2018-03-28T16_31_29_299Z-debug.log

Following are content of above log file:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/6.8.1/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'token',
1 verbose cli   'list' ]
2 info using [email protected]
3 info using [email protected]
4 info token getting list
5 http request → GET https://registry.npmjs.org/-/npm/v1/tokens
6 http 401 ← Unauthorized (https://registry.npmjs.org/-/npm/v1/tokens)
7 verbose stack Error: Unable to authenticate, need: Basic, Bearer
7 verbose stack     at fetch.defaults.catch.then.then.result (/usr/local/lib/node_modules/npm/node_modules/npm-profile/index.js:373:15)
7 verbose stack     at process._tickCallback (internal/process/next_tick.js:103:7)
8 verbose statusCode 401
9 verbose cwd /Users/saurabh.mimani/work/codes/mongoose-diff-history
10 verbose Darwin 17.4.0
11 verbose argv "/usr/local/Cellar/node/6.8.1/bin/node" "/usr/local/bin/npm" "token" "list"
12 verbose node v6.8.1
13 verbose npm  v5.8.0
14 error code EAUTHIP
15 error Unable to authenticate, need: Basic, Bearer
16 verbose exit [ 1, true ]

What needs to be done to properly authenticate and add token in CLI.

like image 672
Saurabh Avatar asked Mar 28 '18 16:03

Saurabh


2 Answers

I was probably going in wrong direction. I did login in cli using

npm login

and after that I was able to do npm token list and other related commands easily, without any issue.

like image 187
Saurabh Avatar answered Oct 17 '22 10:10

Saurabh


I had the same problem, but my issue wasn't solved until I deleted the .npmrc file in my current dir.

Even when I tried to get my user after a succesful npm login I got this:

$ npm whoami --verbode
npm ERR! code E401
npm verb stack Error: Registry returned 401 for GET on http://registry.npmjs.org/-/whoami

More info at: https://github.com/npm/npm/issues/16448

like image 41
Troglo Avatar answered Oct 17 '22 12:10

Troglo