Composer安装时要求输入授权用户名密码是什么原因
更新:HHH   时间:2023-1-7


这篇文章主要介绍“Composer安装时要求输入授权用户名密码是什么原因”,在日常操作中,相信很多人在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 'https://packagist.phpcomposer.com/p/saviorlv/yii2-dysms%24045b85ee8f7a846caecdf82efa78fb4927e19868940b05fbb3ddb6383a10d41f.json', 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帐户存在欠费问题,导致操作无法成功完成”.....

改用国内镜像源就好了 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安装时要求输入授权用户名密码是什么原因”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注天达云网站,小编会继续努力为大家带来更多实用的文章!

返回软件技术教程...