首頁 >開發工具 >composer >Composer安裝時要求輸入授權使用者名稱密碼是怎麼回事

Composer安裝時要求輸入授權使用者名稱密碼是怎麼回事

藏色散人
藏色散人轉載
2021-06-15 11:28:262470瀏覽

下面由composer教學欄位介紹關於Composer 安裝時要求輸入授權使用者名稱密碼的問題,希望對需要的朋友有幫助!

D:\work\dreamland-yii>composer require "saviorlv/yii2-dysms:dev-master"

    Authentication required (packagist.phpcomposer.com):
      Username:
      Password:


  [Composer\Downloader\TransportException]
  Invalid credentials for &#39;https://packagist.phpcomposer.com/p/saviorlv/yii2-dysms%24045b85ee8f7a846caecdf82efa78fb4927e19868940b05fbb3ddb6383a10d41f.json&#39;, aborting.require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

需要改為中國的composer來源,請求介面顯示的「There is an arrear problem with this JSS account that prevents the operation from completing successfully」 翻譯為:「此JSS帳號有欠費問題,導致 completing successfully」翻譯為:「此JSS帳號有欠費問題,導致操作無法成功完成」.....

改用國內鏡像來源就好了https://pkg.phpcomposer.com/

composer config -g repo.packagist composer https://packagist.phpcomposer.com

 然後我這裡又出現一個問題

D:\work\dreamland-yii>composer require "saviorlv/yii2-dysms:dev-master"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

Could not fetch https://api.github.com/repos/bestiejs/punycode.js/tags?per_page=100, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+JL-HOST-008-PC+2018-10-13+0916
to retrieve a token. It will be stored in "C:/Users/niuben/AppData/Roaming/Composer/auth.json" for future use by Composer.
Token (hidden):

 它讓我輸入一個token? ? ?

經過網路查詢這是因為Composer 沒有加入github金鑰

解決方法

進入https://github.com/settings/tokens 點擊「Generate new token” (記得先登入哦

新建一個Token,輸入描述,選擇預設新建就行,然後就會得到一個Token,然後把這個值貼過去就OK 了。

 

以上是Composer安裝時要求輸入授權使用者名稱密碼是怎麼回事的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:csdn.net。如有侵權,請聯絡admin@php.cn刪除