4

I clone a project from git.
After i run command:
- composer dump-autoload
- composer updated

File 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.*",
        "zizaco/entrust": "5.2.x-dev",
        "doctrine/dbal": "^2.5",
        "intervention/image": "^2.3"
    },
    "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": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

File evn

APP_ENV=local
APP_DEBUG=true APP_KEY=SomeRandomString
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1 DB_PORT=3306
DB_DATABASE=wicker_master
DB_USERNAME=root
DB_PASSWORD=root

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Error:

> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize


  [Illuminate\Database\QueryException]                                                                                              
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wicker_master.about_us' doesn't exist (SQL: select * from `about_us`)  



  [PDOException]                                                                                    
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wicker_master.about_us' doesn't exist  


Script php artisan optimize handling the post-update-cmd event returned with error code 1
8
  • It seems like the project you copied tries to access a table in the postUpdate method. You can check that in your composer.json. For a quick fix remove the responsible line, then run composer update + php artisan migrate, then re-insert the line.
    – Frnak
    Dec 13, 2016 at 6:26
  • I removed it, but it isn't working.
    – Huan Ho
    Dec 13, 2016 at 7:23
  • I think it execute the last file migrate not run all file migrate
    – Huan Ho
    Dec 13, 2016 at 7:28
  • What is the error after removing it? Provide your composer.json - also ensure to remove the composer.lock. Show us your .env structure but please anonymise it.
    – Frnak
    Dec 13, 2016 at 7:41
  • Error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wicker_master.about_us' doesn't exist (SQL: select * from about_us). I add more file .evn and composer.json
    – Huan Ho
    Dec 13, 2016 at 8:09

1 Answer 1

1

Do you have same db name created as in .env file ?
For example if you have written

DB_DATABASE=laravel

make sure you have create database named laravelfirst

5
  • I created db name in file .env
    – Huan Ho
    Dec 13, 2016 at 6:32
  • For example if you have written DB_DATABASE=laravel make sure you have create database named laravel first. Dec 13, 2016 at 6:35
  • It seems that you don't have database created that you have named in .env fille Dec 13, 2016 at 6:36
  • I created Database and edit name database in file .env.
    – Huan Ho
    Dec 13, 2016 at 7:08
  • Share the link of git project you cloned Dec 13, 2016 at 7:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.