克隆laravel 5.2项目的Git不会迁移

时间:2016-12-13 06:24:27

标签: laravel laravel-5 composer-php

我从git克隆一个项目 我运行命令后:
- composer dump-autoload
- 作曲家更新

文件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"
    }
}

文件evn

  

APP_ENV =本地
  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 =根
  DB_PASSWORD = root

     

CACHE_DRIVER =文件
  SESSION_DRIVER =文件
  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

错误:

> 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

1 个答案:

答案 0 :(得分:1)

您是否在.env文件中创建了相同的数据库名称?
例如,如果你已经写了

DB_DATABASE=laravel

确保首先创建名为laravel的数据库