4

I want to make a new Symfony project but it gives me an UnexpectedValueException.

whether I use: symfony new my_project_name --full or composer create-project symfony/website-skeleton my_project_name, I get this response:

Creating a "symfony/website-skeleton" project at "./my_project_name"
Installing symfony/website-skeleton (v5.1.99)
  - Installing symfony/website-skeleton (v5.1.99): Loading from cache
Created project in C:\xampp\htdocs\my_project_name
Loading composer repositories with package information
Updating dependencies (including require-dev)


  [UnexpectedValueException]
  Invalid version string "5.x"


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

I'm following the exact instructions on symfony.com - Installing & Setting up the Symfony Framework

It only generates a composer.json file and a LICENSE file.

composer.json looks like this:

{
    "name": "symfony/website-skeleton",
    "type": "project",
    "license": "MIT",
    "description": "A skeleton to start a new Symfony website",
    "require": {
        "php": ">=7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "symfony/flex": "^1.3.1"
    },
    "flex-require": {
        "sensio/framework-extra-bundle": "^5.1",
        "symfony/asset": "*",
        "symfony/console": "*",
        "symfony/dotenv": "*",
        "symfony/expression-language": "*",
        "symfony/form": "*",
        "symfony/framework-bundle": "*",
        "symfony/http-client": "*",
        "symfony/intl": "*",
        "symfony/mailer": "*",
        "symfony/mime": "*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/notifier": "*",
        "symfony/orm-pack": "*",
        "symfony/process": "*",
        "symfony/security-bundle": "*",
        "symfony/serializer-pack": "*",
        "symfony/string": "*",
        "symfony/translation": "*",
        "symfony/twig-pack": "*",
        "symfony/validator": "*",
        "symfony/web-link": "*",
        "symfony/yaml": "*"
    },
    "require-dev": {
    },
    "flex-require-dev": {
        "symfony/debug-pack": "*",
        "symfony/maker-bundle": "^1.0",
        "symfony/profiler-pack": "*",
        "symfony/test-pack": "*"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": [
        ],
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.1.*"
        }
    }
}
4
  • Check your php version with "php --version" from the command line. Do the same for composer "composer --version" Commented Oct 8, 2020 at 16:38
  • ``` Composer version 1.10.13 2020-09-09 11:46:34 ``` ``` PHP 7.4.8 (cli) (built: Jul 9 2020 11:30:39) ( ZTS Visual C++ 2017 x64 ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies ``` Commented Oct 8, 2020 at 18:59
  • I have uninstalled and reinstalled the Symfony CLI as well as composer and it works again, but i'm still not sure what caused it. Commented Oct 8, 2020 at 19:40
  • 1
    I have the exact same error. I tried uninstalling and reinstalling symfony and composer but that didn't fix it for me. Commented Oct 9, 2020 at 15:03

2 Answers 2

1

Uninstall and reinstall composer on your computer.

I had the same problem and it worked for me.

Sign up to request clarification or add additional context in comments.

Comments

0

Try to remove folders: vendor/ and var/

  • Run composer update
  • After that checkout symfony console cache:clear

If there are any errors, then run composer recipes:install --force -v. And resolve it.

2 Comments

You can't remove the folders vendor and var if these folders don't exist yet though. I was trying to create a new project.
Oh right, I just had this problem with an existing project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.