Please provide a valid cache path

Just followed the instructions to install Sage 10.

Straight into an Exception on running yarn dev once I had correctly set up the proxy URL. Accessing the app via http://0.0.0.0:3000 gives an Exception: “Please provide a valid cache path.”

I manually created the locations within storage to no avail.

Has anyone got a clue why this is happening?

EDIT (5 hours later):

Digging into the code, view.compiled is being passed to the Blade Compiler as null in this ViewServiceProvider function.

/**
     * Register the Blade compiler implementation.
     *
     * @return void
     */
    public function registerBladeCompiler()
    {
        $this->app->singleton('blade.compiler', function ($app) {
            return tap(new BladeCompiler($app['files'], $app['config']['view.compiled']), function ($blade) {
                $blade->component('dynamic-component', DynamicComponent::class);
            });
        });
    }

I looked at vendor/roots/acorn/config/view.php which is where the compiled view path is set in $app['config']. The line is as follows:

'compiled' => env('VIEW_COMPILED_PATH', storage_path('framework/views')),

I have not got a VIEW_COMPILED_PATH definition in my .env file so it should default to storage_path('framework/views') but it simply doesn’t. It provides null

When I comment out this line and change to:

'compiled' => storage_path('framework/views'),

then the whole app works as expected.

No idea what is going on here but it’s all a bit strange. Any reason why the default setting for the env call is not populating?

Another edit:

There is a conflict with the env helper function in the roots/bedrock stack I am using:

/vendor/oscarotero/env/src/env_function.php - this declares env but without the second argument that allows the default setting to pass through if the key is not defined, so the Laravel env helper does not register due to the if (! function_exists('env')) check.

I changed it so that it was a default WordPress install and put the Sage 10 theme in there - everything works fine.

I’ll leave this up in case anyone else has the same issue.

2 Likes