Error: No supported encrypter found. The cipher and / or key length are invalid

1

I am using laravel 5.2 and I have been authenticating myself, but when I run the command php artisan make:auth it works perfect, but in practice it does not ... When I click login or register it gives me this error:

  

No supported encrypter found. The cipher and / or key length are invalid.

How can I fix it? Composer.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*"

    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}
    
asked by anonymous 24.02.2016 / 13:50

2 answers

2

If you navigated to the project folder and there is no .env.example , there was a failure in Laravel installation, when we installed Laravel the first time through the composer it generates a copy inside the composer folder, so if you create new ones projects (probably by artesian ) it will fetch from the local copy, check the folder that was installed, usually the location that is saved is ~/.composer/vendor/bin , if you think something failed to install the composer, use the command like this:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

When creating a project use the --prefer-dist parameter, like this:

composer create-project --prefer-dist laravel/laravel meuprimeiroprojeto

To check if everything is ok, navigate to the folder by typing:

cd meuprimeiroprojeto
ls -a

Will display all files, should appear .env.example

    
24.02.2016 / 15:00
0

First of all, you must generate your APP_KEY:

php artisan key:generate

If it still is not working, check the config / app.php file if it is set to:

'cipher' => 'AES-256-CBC'

And if the .env file exists ... if not, you should rename the .env.example to .env p>     

24.02.2016 / 14:10