NPM ERR 代码 E401:无法验证,需要:承载授权 [英] NPM ERR Code E401: Unable to authenticate, need: Bearer authorization
本文介绍了NPM ERR 代码 E401:无法验证,需要:承载授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从 GitHub 下载了一个 NodeJS 应用程序,在执行 npm install 时遇到以下错误.
I downloaded a NodeJS application from GitHub and faces following error when executing npm install.
npm ERR! code E401
npm ERR! Unable to authenticate, need: Bearer authorization_uri=https://login.windows.net/c1156c2f-a3bb-4fc4-ac07-3eab96da8d10, Basic realm="https://pkgsprodeus21.pkgs.visualstudio.com/", TFS-Federated
我的 Node 版本是 6.13.1,NPM 版本是 6.13.4以下是 package.json 文件的内容:
My Node version is 6.13.1 and NPM version is 6.13.4 Following is the content of package.json file:
{
"name": "DemoApp",
"version": "1.0.0",
"description": "A social oasis for lovers of pizza.",
"repository": "****",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "****",
"license": "MIT",
"dependencies": {
"@hapi/boom": "7.4.2",
"@hapi/catbox": "10.2.1",
"@hapi/catbox-redis": "5.0.2",
"@hapi/cookie": "10.1.0",
"@hapi/good": "8.2.0",
"@hapi/good-squeeze": "5.2.0",
"@hapi/hapi": "18.3.1",
"@hapi/inert": "5.2.1",
"@hapi/joi": "15.1.0",
"@hapi/vision": "5.5.2",
"aws-sdk": "2.488.0",
"bcryptjs": "2.4.3",
"bootflat": "2.0.4",
"fs-extra": "8.1.0",
"handlebars": "4.1.2",
"lodash": "4.17.13",
"pg": "7.11.0",
"sequelize": "5.9.4"
}
}
我从昨天开始就一直被这个问题困扰,但仍然没有找到解决方案.任何帮助将不胜感激.
I have been stuck at this issue since yesterday and still no luck finding the solution. Any help would be highly appreciated.
推荐答案
这对我有用.
首先,删除用户文件夹中的 .npmrc 文件.此文件夹:
This is what worked for me.
First, delete the .npmrc file in your Users folder. This folder:
C:\Users\[your user name]
然后在包含 .npmrc 文件的项目文件夹中运行此命令:
Then run this command in your project folder that has an .npmrc file in it:
npx vsts-npm-auth -config .npmrc
这篇关于NPM ERR 代码 E401:无法验证,需要:承载授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文