Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After installed composer and get this error when i try composer -v (MAC OS) #10685

Closed
charlie-nguyen-goldenowl opened this issue Apr 1, 2022 · 2 comments
Labels
Milestone

Comments

@charlie-nguyen-goldenowl
Copy link

@charlie-nguyen-goldenowl charlie-nguyen-goldenowl commented Apr 1, 2022

macOS:

Catalina version 10.15.7 (19H1715)

Composer: composer --version

Composer 2.3.2 2022-03-30 20:45:25

PHP: php -v

PHP 8.0.17 (cli) (built: Mar 18 2022 09:45:17) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.17, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.17, Copyright (c), by Zend Technologies

when I'm running:

composer -v or composer update or composer install

error:

PHP Fatal error:  Uncaught TypeError: Composer\Pcre\Preg::isMatch(): Argument #2 ($subject) must be of type string, array given, called in phar:///usr/local/bin/composer/src/Composer/IO/BaseIO.php on line 133 and defined in phar:///usr/local/bin/composer/vendor/composer/pcre/src/Preg.php:241
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/IO/BaseIO.php(133): Composer\Pcre\Preg::isMatch('{^[.A-Za-z0-9_]...', Array)
#1 phar:///usr/local/bin/composer/src/Composer/Factory.php(346): Composer\IO\BaseIO->loadConfiguration(Object(Composer\Config))
#2 phar:///usr/local/bin/composer/src/Composer/Factory.php(610): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, true, '/Users/inmac/pr...', true, false)
#3 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(469): Composer\Factory::create(Object(Composer\IO\ConsoleIO), NULL, true, false)
#4 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(411): Composer\Console\Application->getComposer(false, true)
#5 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(352): Composer\Console\Application->hintCommonErrors(Object(TypeError), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 phar:///usr/local/bin/composer/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(130): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 phar:///usr/local/bin/composer/bin/composer(83): Composer\Console\Application->run()
#9 /usr/local/bin/composer(29): require('phar:///usr/loc...')
#10 {main}
  thrown in phar:///usr/local/bin/composer/vendor/composer/pcre/src/Preg.php on line 241

Fatal error: Uncaught TypeError: Composer\Pcre\Preg::isMatch(): Argument #2 ($subject) must be of type string, array given, called in phar:///usr/local/bin/composer/src/Composer/IO/BaseIO.php on line 133 and defined in phar:///usr/local/bin/composer/vendor/composer/pcre/src/Preg.php:241
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/IO/BaseIO.php(133): Composer\Pcre\Preg::isMatch('{^[.A-Za-z0-9_]...', Array)
#1 phar:///usr/local/bin/composer/src/Composer/Factory.php(346): Composer\IO\BaseIO->loadConfiguration(Object(Composer\Config))
#2 phar:///usr/local/bin/composer/src/Composer/Factory.php(610): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, true, '/Users/inmac/pr...', true, false)
#3 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(469): Composer\Factory::create(Object(Composer\IO\ConsoleIO), NULL, true, false)
#4 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(411): Composer\Console\Application->getComposer(false, true)
#5 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(352): Composer\Console\Application->hintCommonErrors(Object(TypeError), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 phar:///usr/local/bin/composer/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(130): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 phar:///usr/local/bin/composer/bin/composer(83): Composer\Console\Application->run()
#9 /usr/local/bin/composer(29): require('phar:///usr/loc...')
#10 {main}
  thrown in phar:///usr/local/bin/composer/vendor/composer/pcre/src/Preg.php on line 241

@charlie-nguyen-goldenowl charlie-nguyen-goldenowl changed the title I'm install composer and get this error when i try composer -v (MAC OS) After installed composer and get this error when i try composer -v (MAC OS) Apr 1, 2022
@Seldaek Seldaek added this to the 2.3 milestone Apr 1, 2022
@Seldaek Seldaek added the Bug label Apr 1, 2022
@Seldaek
Copy link
Member

@Seldaek Seldaek commented Apr 1, 2022

That seems to be due to an improperly configured github token in auth.json.

Check the output of composer -vvv to see which files it loads, then check them for presence of github auth config. It should look like {"github.com": "[token string here]"} but you seem to have an array instead of a string.

@Seldaek Seldaek closed this as completed in 8e93566 Apr 1, 2022
@charlie-nguyen-goldenowl
Copy link
Author

@charlie-nguyen-goldenowl charlie-nguyen-goldenowl commented Apr 1, 2022

thanks @Seldaek , you make my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants