Seld \ JsonLint \ ParsingException“ /root/.composer/auth.json”在安装后不包含有效的JSON

问题描述 投票:0回答:1

我已通过instruction in download page在ubuntu服务器上安装了作曲程序以进行命令行安装。

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

并且对于全局安装,遵循getting started指令:

mv composer.phar /usr/local/bin/composer

运行命令后,我得到:所有设置均可正确使用Composer正在下载...

Composer (version 1.10.4) successfully installed to: /root/composer.phar
Use it: php composer.phar

但是现在当我输入composer命令时遇到此错误:

  [Seld\JsonLint\ParsingException]
  "/root/.composer/auth.json" does not contain valid JSON
  Parse error on line 1:

  ^
  Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

我尝试了curl -sS https://getcomposer.org/installer | php -- --check并得到了这个:

All settings correct for using Composer

并且当使用composer diagnose时也会出现相同的错误。尝试清除并重新安装,但未更改:

sudo apt-get purge --auto-remove composer
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'composer' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

/root/.composer/auth.json文件为空

composer-php ubuntu-18.04 vps
1个回答
0
投票

错误消息告诉您有关此问题的信息:/root/.composer/auth.json的内容不是有效的JSON。如果该文件为空,则无需将其保留在此处-因此,将身份验证详细信息放在该文件中或删除该文件,直到您需要

© www.soinside.com 2019 - 2024. All rights reserved.