简体   繁体   English

Laravel 5.4-将文件上传到服务器后出现错误

[英]Laravel 5.4 - Error after Uploading Files to Server

My project works fine in my localhost but when I upload I get the following error : 我的项目在本地主机上运行良好,但是在上载时出现以下错误:

(3/3) ErrorException The Mix manifest does not exist. 

Any ideas how I can solve it? 有什么办法可以解决吗? I have previously had some other errors (like welcome.blade not defined). 我以前有其他一些错误(例如,未定义的welcome.blade)。

Just go to under the app/Providers, you will find your AppServiceProvider file and inside boot() method make the binding as below. 只需转到app / Providers下,您将找到您的AppServiceProvider文件,并在boot()方法内部进行如下绑定。

  $this->app->bind('path.public', function() {
    return base_path().'/../public_html';
});

您也可以尝试运行给定命令

composer update

run this in your terminal 在您的终端上运行

npm install npm安装

npm run dev npm run dev

if in production it is 如果在生产中

npm run production npm运行生产

You need to upload your /public/mix-manifest.json file to the server. 您需要将/public/mix-manifest.json文件上传到服务器。 This is a small file that contain versioning information for JavaScript and CSS assets to help with cache busting. 这是一个小文件,其中包含JavaScript和CSS资产的版本控制信息,以帮助清除缓存。 In your Blade files you can use mix('some-file.js') and so long as it's in the mix manifest Laravel will create a URL with the a version querystring. 在您的Blade文件中,您可以使用mix('some-file.js') ,只要它在混合清单中,Laravel就会创建一个带有版本查询字符串的URL。 See: https://laravel.com/docs/5.7/mix 参见: https : //laravel.com/docs/5.7/mix

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM