Server side rendering not working in Laravel React project

Viewed 260

I am running Laravel 8.0 with React 17.0.2.

I am trying to implement SSR for optimizing the app. For that I am referring this youtube tutorial which is using this package by spatie.

After setting up everything, I am getting the follwoing error

file_put_contents(../storage/app/ssr/9fa7979d88956cb5cc5019e5ee1fe73b.js): Failed to open stream: No such file or directory (View: ../resources/views/index.blade.php)

There is a config file ssr.php where I need to defined node.temp path

'node' => [
    'node_path' => env('NODE_PATH', '/usr/local/bin/node'),
    'temp_path' => env('SSR_TEMP_PATH', storage_path('app/ssr')),
],

What should be this temp_path as there is no such directory called ssr in my app folder?

2 Answers

Create a directory with the name ssr inside /storage/app and give it permission 777, it will resolve your issue.

Create a folder inside app/ssr and there should be no space in any folder name of the path to the laravel project. I hope it will work for you.

Related