簡體   English   中英

npm 錯誤 E401:無法驗證,需要:Basic realm="GitHub"

[英]npm error E401: Unable to authenticate, need: Basic realm="GitHub"

我對節點 v10.15.1 和 npm v6.14.15 有疑問

運行npm install到項目的根文件夾,我有以下錯誤:

npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myuser/.npm/_logs/2022-08-10T17_31_09_840Z-debug.log

日志文件報告了這一點:

2675 verbose stack Error: Unable to authenticate, need: Basic realm="GitHub"
2675 verbose stack     at res.buffer.catch.then.body (/Users/myuser/.nvm/versions/node/v10.15.1/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:107:17)
2675 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
2676 verbose statusCode 401
2677 verbose pkgid socket.io-client@https://github.com/substack/socket.io-client/tarball/master
2678 verbose cwd /Users/myuser/myproject
2679 verbose Darwin 20.6.0
2680 verbose argv "/Users/myuser/.nvm/versions/node/v10.15.1/bin/node" "/Users/myuser/.nvm/versions/node/v10.15.1/bin/npm" "install"
2681 verbose node v10.15.1
2682 verbose npm  v6.14.15
2683 error code E401
2684 error Unable to authenticate, need: Basic realm="GitHub"
2685 verbose exit [ 1, true ]

我還有其他項目可以完美編譯節點 v10.15.1 和 npm v6.14.15

任何幫助將不勝感激。

謝謝

我自己解決了這個問題。

如果您有類似的問題,請檢查您的 npm 配置,如果您有選項always-auth=true ,請輸入:

npm config list

就我而言,我有:

; userconfig /Users/myuser/.npmrc
always-auth = true

為了繞過這個問題,在你的項目的根文件夾中創建一個 .npmrc 文件並強制屬性為 false:

always-auth = false

現在, npm config list應該顯示如下內容:

; project config /Users/myuser/myproject/.npmrc
always-auth = false

使用此配置,您應該解決 E401 Basic realm="GitHub"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM