我刚刚使用以下命令升级了npm:
npm install npm@latest -g
当我做npm token list现在,我收到以下错误:
npm ERR!代码EAUTHIP
npm ERR!无法验证,需要:基本,承载
npm ERR!可以在以下位置找到此运行的完整日志:
npm ERR!/Users/USerName/.npm/_logs/2018-03-28T16_31_29_299Z-debug.log
以下是上述日志文件的内容:
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 ]
Run Code Online (Sandbox Code Playgroud)
需要执行哪些操作才能在CLI中正确地进行身份验证和添加令牌。
我可能走错了方向。我确实使用登录了cli
npm login
Run Code Online (Sandbox Code Playgroud)
之后,我可以npm token list轻松地执行其他相关命令,而没有任何问题。