How to solve Exception It is unsafe to run Dusk in production in laravel 5.5?

孤人 提交于 2019-12-04 05:22:57
CUGreen

In Laravel 5.5, packages are automatically discovered and loaded so you will probably need to tell it not to load dusk.

One way is to add this to your composer.json

"extra": {
    "laravel": {
        "dont-discover": [
            "laravel/dusk"
        ]
    }
},

Also, you can add it to your dev dependencies and when you deploy in production, use:

composer install --no-dev

Taylor wrote an article about it here.

Look, it does not work because it is configured to work on local and testing environment. I guess that you need to add 'production' (if your production is called 'production in your .env file environment:

public function register()
{
    // Dusk, if env is appropriate
    if ($this->app->environment('local', 'testing', 'production')) {
        $this->app->register(DuskServiceProvider::class);
    }
}

When installing to production server I just needed to use the --no-dev flag

composer install --no-dev

Good luck!

Check whether file which named .env contained in the source folder and setup Database user name and password and other settings.

I had the same problem because I have set all the things but forgot to change the .env.example to .env

If you're experiencing this problem while in a developing environment and accidentally landed here due to the title, you should check that your .env file is set up for development. It should contain the line

APP_ENV=local

Here is an example of how the .env file could look: https://github.com/laravel/laravel/blob/master/.env.example

And here is the Laravel documentation: https://laravel.com/docs/5.7/configuration


Also, in composer.json, laravel/dusk should be listed under require-dev and not require.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!