I'm trying to create a new Symfony project using composer create-project symfony/website-skeleton
, but I'm encountering a pretty cryptic error while doing so:
[Seld\JsonLint\ParsingException]
"https://flex.symfony.com/p/symfony,flex,iv1.4.4,1562912965" does not contain valid JSON
Parse error on line 1:
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
I'm behind a corporate proxy, and have a http_proxy environment variable set up. I'm using Windows 10, and one of my colleagues using Windows 7 can use the command just fine. I can access the file from a browser.
Here's part of the verbose output:
Installs: symfony/flex:v1.4.4
- Installing symfony/flex (v1.4.4): Downloading https://api.github.com/repos/symfony/flex/zipball/4b5d25a5538e2dc37ff84645fe7498a9a04947b3 using proxy tcp://10.253.35.2:3128
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/symfony/flex/legacy.zip/4b5d25a5538e2dc37ff84645fe7498a9a04947b3
Downloading https://codeload.github.com/symfony/flex/legacy.zip/4b5d25a5538e2dc37ff84645fe7498a9a0494Downloading (100%)Writing C:/Users/xxx/AppData/Local/Composer/files/symfony/flex/fad7a4db67a7fb5211c7a3a547ef84ef86431bd3.zip into cache from A:\lims-api\vendor/symfony/flex/9a283015aad4190ca526aa484fa25343
Extracting archiveLoading plugin Symfony\Flex\Flex
Downloading https://flex.symfony.com/p/symfony,flex,iv1.4.4,1562912965 using proxy tcp://10.253.35.2:3128
Downloading https://flex.symfony.com/p/symfony,flex,iv1.4.4,1562912965 using proxy tcp://10.253.35.2:3128
Downloading https://flex.symfony.com/p/symfony,flex,iv1.4.4,1562912965 using proxy tcp://10.253.35.2:3128
Reading ./composer.json
Loading config file ./composer.json
Failed to initialize global composer: Composer could not find the config file: C:/Users/xxx/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading A:\lims-api/vendor/composer/installed.json
[Seld\JsonLint\ParsingException]
"https://flex.symfony.com/p/symfony,flex,iv1.4.4,1562912965" does not contain valid JSON
Parse error on line 1:
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
Exception trace:
() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Json/JsonFile.php:299
Composer\Json\JsonFile::validateSyntax() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Json/JsonFile.php:272
Composer\Json\JsonFile::parseJson() at A:\lims-api\vendor\symfony\flex\src\Downloader.php:248
Symfony\Flex\Downloader->parseJson() at A:\lims-api\vendor\symfony\flex\src\Downloader.php:194
Symfony\Flex\Downloader->fetchFile() at A:\lims-api\vendor\symfony\flex\src\Downloader.php:183
Symfony\Flex\Downloader->get() at A:\lims-api\vendor\symfony\flex\src\Downloader.php:138
Symfony\Flex\Downloader->Symfony\Flex\{closure}() at A:\lims-api\vendor\symfony\flex\src\ParallelDownloader.php:278
Symfony\Flex\ParallelDownloader->getNext() at A:\lims-api\vendor\symfony\flex\src\ParallelDownloader.php:90
Symfony\Flex\ParallelDownloader->download() at A:\lims-api\vendor\symfony\flex\src\Downloader.php:141
Symfony\Flex\Downloader->getRecipes() at A:\lims-api\vendor\symfony\flex\src\Flex.php:691
Symfony\Flex\Flex->fetchRecipes() at A:\lims-api\vendor\symfony\flex\src\Flex.php:419
Symfony\Flex\Flex->install() at A:\lims-api\vendor\symfony\flex\src\Flex.php:339
Symfony\Flex\Flex->update() at A:\lims-api\vendor\symfony\flex\src\Flex.php:320
Symfony\Flex\Flex->checkForUpdate() at n/a:n/a
call_user_func() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:176
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:116
Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:620
Composer\Installer->doInstall() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:229
Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/CreateProjectCommand.php:195
Composer\Command\CreateProjectCommand->installProject() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/CreateProjectCommand.php:145
Composer\Command\CreateProjectCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:258
Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:104
Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:61
require() at C:\ProgramData\ComposerSetup\bin\composer.phar:24
I'd appreciate any idea of what I could try :)
This issue: https://github.com/symfony/flex/issues/484 does not seem to be the same but it gave me the idea to try with another version of PHP; I was using PHP 7.3.7, and it works correctly using PHP 7.1.30.
I don't know if the incompatibility comes from symfony/flex or composer itself, but I suppose this should be reported somewhere?