我正在尝试使用composer create-project symfony/website-skeleton
创建一个新的Symfony项目,但是在这样做时遇到了一个非常神秘的错误:
[SeldJsonLintParsingException]
"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-apivendor/symfony/flex/9a283015aad4190ca526aa484fa25343
Extracting archiveLoading plugin SymfonyFlexFlex
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
[SeldJsonLintParsingException]
"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
ComposerJsonJsonFile::validateSyntax() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Json/JsonFile.php:272
ComposerJsonJsonFile::parseJson() at A:lims-apivendorsymfonyflexsrcDownloader.php:248
SymfonyFlexDownloader->parseJson() at A:lims-apivendorsymfonyflexsrcDownloader.php:194
SymfonyFlexDownloader->fetchFile() at A:lims-apivendorsymfonyflexsrcDownloader.php:183
SymfonyFlexDownloader->get() at A:lims-apivendorsymfonyflexsrcDownloader.php:138
SymfonyFlexDownloader->SymfonyFlex{closure}() at A:lims-apivendorsymfonyflexsrcParallelDownloader.php:278
SymfonyFlexParallelDownloader->getNext() at A:lims-apivendorsymfonyflexsrcParallelDownloader.php:90
SymfonyFlexParallelDownloader->download() at A:lims-apivendorsymfonyflexsrcDownloader.php:141
SymfonyFlexDownloader->getRecipes() at A:lims-apivendorsymfonyflexsrcFlex.php:691
SymfonyFlexFlex->fetchRecipes() at A:lims-apivendorsymfonyflexsrcFlex.php:419
SymfonyFlexFlex->install() at A:lims-apivendorsymfonyflexsrcFlex.php:339
SymfonyFlexFlex->update() at A:lims-apivendorsymfonyflexsrcFlex.php:320
SymfonyFlexFlex->checkForUpdate() at n/a:n/a
call_user_func() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:176
ComposerEventDispatcherEventDispatcher->doDispatch() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:116
ComposerEventDispatcherEventDispatcher->dispatchPackageEvent() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:620
ComposerInstaller->doInstall() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:229
ComposerInstaller->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/CreateProjectCommand.php:195
ComposerCommandCreateProjectCommand->installProject() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/CreateProjectCommand.php:145
ComposerCommandCreateProjectCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
SymfonyComponentConsoleCommandCommand->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
SymfonyComponentConsoleApplication->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
SymfonyComponentConsoleApplication->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:258
ComposerConsoleApplication->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
SymfonyComponentConsoleApplication->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:104
ComposerConsoleApplication->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:61
require() at C:ProgramDataComposerSetupbincomposer.phar:24
我希望有任何关于我可以尝试的想法:)
:https://github.com/symfony/flex/issues/484 似乎不一样,但它给了我尝试使用另一个版本的PHP的想法;我使用的是 PHP 7.3.7,使用 PHP 7.1.30 可以正常工作。
我不知道不兼容是来自symfony/flex还是作曲家本身,但我想这应该在某个地方报告?