我正在尝试使用composer create-project symfony/website-skeleton
创建一个新的Symfony项目,但这样做时却遇到了一个非常神秘的错误:
[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', '{', '['
我在公司代理后面,并设置了http_proxy环境变量。我正在使用Windows 10,并且使用Windows 7的一位同事可以使用该命令。我可以从浏览器访问文件。
这是详细输出的一部分:
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
对于可以尝试的方法的任何想法,我将不胜感激。
答案 0 :(得分:0)
此问题:https://github.com/symfony/flex/issues/484似乎并不相同,但是它给了我尝试使用另一版本的PHP的想法。我使用的是PHP 7.3.7,使用PHP 7.1.30即可正常工作。
我不知道这种不兼容性是否来自symfony / flex或作曲家本身,但我想应该在某处进行报告?