Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 本地主机上的Laravel资产返回404_Php_Css_Laravel 5_Assets - Fatal编程技术网

Php 本地主机上的Laravel资产返回404

Php 本地主机上的Laravel资产返回404,php,css,laravel-5,assets,Php,Css,Laravel 5,Assets,我对拉雷维尔还很陌生。我使用Ubuntu并从主文件夹上的GitHub克隆了一个应用程序。当我使用php artisan serve运行应用程序时,我没有看到页面样式。Ctrl-u显示源代码时没有问题,但是控制台中有404个关于资产文件夹下所有内容的错误。 我的000_default.conf文件是 /etc/apache2/sites-enabled/000-defult.conf <VirtualHost *:80> Serve

我对拉雷维尔还很陌生。我使用Ubuntu并从主文件夹上的GitHub克隆了一个应用程序。当我使用php artisan serve运行应用程序时,我没有看到页面样式。Ctrl-u显示源代码时没有问题,但是控制台中有404个关于资产文件夹下所有内容的错误。

我的000_default.conf文件是

/etc/apache2/sites-enabled/000-defult.conf                 
<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot ~/_/www/easymove/public

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/laravel>
                AllowOverride All
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>



您需要在webpack.mix.js中添加一些规则来处理您的资产

目前,你的网页只会编译JS文件。您还需要让它复制图像的文件和目录,并根据其当前所在位置编译css:


你有没有整理你的资产?是的,我有。我运行了命令:npm run dev和npm run production在这种情况下,您需要更新您的问题,并提供以下方面的更多信息:1。你所做的2。您正在经历的错误是准确的3。您的资产存储在哪里,混合文件的内容,以及运行混合后编译的资产在哪里。这些就足够了吗?还有什么我可以提供的吗?太好了!我在你的webmix中没有看到任何用于编译图像的内容。所以你有两个选择。自己将它们移动到公共的相关目录中,或者创建一些附加的网页规则来为您执行此操作。文档与我在上面给你的链接相同。
const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');