In Magento2 when I am running
composer update
with non root user I am getting the error like:
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>]...
and I run the same command with root user there is no error but the files generated are in the wrong path:
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]#
How I can fix this?
Update As suggested by Rob006 I reinstalled Composer as non root user, but now I am facing another issue:
when running composer update I am getting this exception error:
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
I am not getting a chance to give username.