Skip to content
Advertisement

Composer giving error after updating to version 2

I updated my composer to version 2. Here is my composer.json file

{
    "name": "periperi",
    "require": {
        "cakephp/cakephp": "2.10.*",
        "stripe/stripe-php": "^7.28",
        "google/apiclient": "^2.7"
    },
    "config": {
        "vendor-dir": "Vendor/"
    }
}

The name was peri-peri, but it was giving error

[ComposerJsonJsonValidationException]                                                                     
  "./composer.json" does not match the expected JSON schema:                                                  
   - name : Does not match the regex pattern ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$  
                                                                                                              

I changed the name to periperi, but it still gives same error. How can I fix this?

Advertisement

Answer

Attempting to use the same composer.json with composer 1.10.19 you would get:

Deprecation warning: Your package name periperi is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match “^a-z0-9/a-z0-9$”. Make sure you fix this as Composer 2.0 will error.

Basically, the project name needs to be: ‘vendor/name’. Choose a vendor name for your “organization”, and you can use the same package name. If your project is not a library, do not worry much about the “vendor” name. It can be simply your name and it wont be published anywhere. E.g muhammad-umar/periperi would be fine.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement