graememullins's avatar

Livewire issue with build

Hi,

I've just built and deployed my app (via git), I get the following error with debug set to true.

I've replaced the actual domain with DOMAIN for privacy.

file_get_contents(/var/www/vhosts/DOMAIN/httpdocs/vendor/livewire/livewire/src/Mechanisms/FrontendAssets/../../../dist/manifest.json): Failed to open stream: No such file or directory (View: /var/www/vhosts/DOMAIN/httpdocs/resources/views/layouts/app.blade.php) (View: /var/www/vhosts/DOMAIN/httpdocs/resources/views/layouts/app.blade.php)

I'm using Livewire 3 with wire navigate, no other livewire added yet.

Any ideas on what this might be?

Graeme

0 likes
19 replies
LaryAI's avatar
Level 58

This error occurs when the manifest.json file is not found in the specified path. To resolve this issue, you can try the following steps:

  1. Make sure that you have run the npm install command to install all the required dependencies.

  2. Run the npm run dev or npm run prod command to generate the necessary assets.

  3. Check if the manifest.json file is present in the public or dist directory of your project.

  4. If the manifest.json file is not present, try running the npm run dev or npm run prod command again to generate the assets.

  5. If the issue persists, you can try deleting the node_modules directory and running npm install again to reinstall the dependencies.

If none of the above steps resolve the issue, you can try posting your question on the Laracasts forum to get more specific help from the community.

Sorry, but I can only answer programming-related questions.
vincent15000's avatar

Perhaps I'm wrong, but it seems that you are on a shared webhosting.

You have all the code in a public folder (httpdocs is public, isn't it ?) and that's really not secure.

From the panel, you should configure the domain so that it points to the public folder of the application.

And if the webhosting allows it, you should create a folder outside the httpdocs folder to put all the application.

graememullins's avatar

Hi,

It's a private cloud server, in plesk the document root is httpdocs/public

Graeme

1 like
graememullins's avatar

The error is within: /var/www/vhosts/DOMAIN/httpdocs/vendor/livewire/livewire/src/Mechanisms/FrontendAssets/FrontendAssets.php:148

It says:

$url = rtrim($url, '/'); $url = (string) str($url)->start('/'); // Add the build manifest hash to it... $manifest = json_decode(file_get_contents(DIR.'/../../../dist/manifest.json'), true); $versionHash = $manifest['/livewire.js']; $url = "{$url}?id={$versionHash}"; $token = app()->has('session.store') ? csrf_token() : '';

However manifest.json is in public/build not a dist folder.

Graeme

1 like
vincent15000's avatar

@graememullins It's normal that the manifest is in a build folder and not a dist folder.

If you don't answer my questions, it will be difficult for me to help you.

graememullins's avatar

@vincent15000 I can create a folder on the server and I can point the domain to a specific folder, apologies, I missed that reply.

1 like
vincent15000's avatar

@graememullins

The problem you encounter is that you have put the Laravel application folder in the public directory of your webhosting and it's very unsecure because you expose a lot of sensitive datas as credentials for the database, ...

Ok ... here is summarized what you can do.

  • clone the repo in a custom folder on your webhosting

  • go into this folder and install composer

  • execute composer install

  • point the domain to the public folder of the Laravel application

graememullins's avatar

The only items in /public are

build (inside this are, manifest.json and assets with the build css and js), ,images ,.htacess ,favicon.ico ,index.php ,robots.txt

All other files are outside of this

1 like
Snapey's avatar

did you run npm run prod on the server?

however, its not needed for Livewire assets

When I remove @livewireStyles @livewireScripts

You dont need to include these at all on Livewire 3

1 like
graememullins's avatar

Hi,

I've not run npm run prod on the server yet, and Livewire 3, doesn't seem to be including the assists on the go, even though I'm using wire:navigate

Graeme

1 like
Ismailidis's avatar

Hi, Has anyone been able to solve this problem? I am currently facing the same problem and do not know how to proceed. I would be very grateful for any advice.

1 like
thinkverse's avatar

Am I missing something here? Everybody is talking about build/prod commands and manifest.json files. However, the error provided by OP says that the resources/views/layouts/app.blade.php file doesn't exist.

Has OP edited the original question with a new one? 🤔

1 like
graememullins's avatar

I still seem to be getting this issue with a project

1 like
thinkverse's avatar

@graememullins Given the issue is related to Livewire 3 internals, all I can recommend is updating to the latest v3 version, if the issue persists open a new bug report in Livewire's discussion panel and see what Caleb and the core team says.

1 like

Please or to participate in this conversation.