我在跑步时在Magento2中
composer update
与非root用户一起出现以下错误:
X-Powered-By: PHP/7.0.31
Content-type: text/html; charset=UTF-8
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
[ErrorException]
file_put_contents(/usr/bin/vendor/composer/installed.json): failed to open stream: Permission denied
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
并且我以root用户运行相同的命令,没有错误,但是生成的文件路径错误:
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
[root@s132-148-137-252 public_html]# ls /usr/bin/vendor/composer/
autoload_classmap.php autoload_namespaces.php autoload_psr4.php autoload_real.php autoload_static.php ClassLoader.php installed.json LICENSE
[root@s132-148-137-252 public_html]#
我该如何解决?
更新 如Rob006所建议 我以非root用户身份重新安装了Composer,但现在我面临另一个问题:
在运行作曲家更新时,出现此异常错误:
X-Powered-By: PHP/7.0.31
Content-type: text/html; charset=UTF-8
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Authentication required (repo.magento.com): Authentication required (repo.magento.com): Authentication required (repo.magento.com):
Username:
[Symfony\Component\Console\Exception\RuntimeException]
Aborted
我没有机会提供用户名。