我从GitHub下载了NodeJS应用程序,执行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文件的内容:
{
  "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"
  }
}
从昨天开始,我一直在这个问题上停留,仍然找不到运气。
任何帮助将不胜感激。

最佳答案

这就是对我有用的。
首先,删除“用户”文件夹中的.npmrc文件。此文件夹:

C:\Users\[your user name]
然后在其中包含.npmrc文件的项目文件夹中运行以下命令:
npx vsts-npm-auth -config .npmrc

关于node.js - NPM ERR代码E401 : Unable to authenticate,需要:承载授权,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59894644/

10-11 09:16