简体   繁体   中英

npm token list giving error

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 npm@5.8.0
3 info using node@v6.8.1
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.

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.

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

If this error in angular project and If you are using TFS then => go to tfs => build=> packages=> select npm => click on generate authentication token button => copy generated text => paste it into your local .npmrc file.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM