未捕获的异常:无法找到混合文件 [英] Uncaught Exception: Unable to locate Mix file

查看:245
本文介绍了未捕获的异常:无法找到混合文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地系统中运行laravel应用.我遵循了 https://gist.github.com/hootlex/da59b91c628a6688ceb1 链接.我运行命令 php artisan serve 命令,当我浏览它时,会产生错误

I am trying to run a laravel app in my local system. I have followed the https://gist.github.com/hootlex/da59b91c628a6688ceb1 link. I run the command php artisan serve command, and when I browse it, then produces the error

PHP Fatal error:  Uncaught Exception: Unable to locate Mix file: /css/vendor.css. Please check your webpack.mix.js output paths and try again. in /var/www/html/laravel-app/app/helpers.php:439

在helpers.php的指定行中,它具有

In the specified line of helpers.php, it has

 if (! isset($manifest[$path])) {
        throw new Exception(
            "Unable to locate Mix file: {$path}. Please check your ".
            'webpack.mix.js output paths and try again.'
        );
    }

public/mix-manifest.json

{
  "/mix.js": "/mix.js"
}

我无法解决它.请帮忙.谢谢

I couldn't sort it out. Please help. Thanks

推荐答案

您正在加载的刀片文件显然具有mix('/css/vendor.css')调用.您可以注释掉这一行,或者安装npm然后构建您的资产.

The blade file you're loading obviously has mix('/css/vendor.css') call. You either comment out this line(s) or install npm then build your assets.

您的清单文件没有/css/vendor.css,但是如果您检查刀片文件(views),则会看到您正在调用mix('/css/vendor.css').因此,如果您找到并注释掉这一行,您的问题将得到解决.

Your manifest file doesn't have /css/vendor.css but if you check your blade files (views) you'll see you are calling mix('/css/vendor.css'). So if you find and comment out this line(s) your problem will be solved.

理想情况下,mix()用于加载由webpack构建的资产.然后它将为您处理版本控制字符串.文档中详细介绍了如何使用 mix .我不会在这里讨论这个问题.

Ideally, mix() is used for loading assets that were built by webpack. It will then take care of the versioning string for you. How mix can be used is detailed in the documentation. I will refrain myself from discussing that here.

您已经通过运行npm run dev或类似命令来构建资产.然后清单文件不包含那些资产映射.而且您的public目录也没有这些资产.然后可以安全地假设您可以从刀片(views)文件中删除那些mix调用.

You've built your assets by running npm run dev or similar commands. And then the manifest file doesn't contain those assets mapping. And your public directory doesn't have those assets as well. Then it's safe to assume that you can remove those mix calls from your blade (views) files.

如果您在public目录中构建了资产,则可以通过assets函数加载这些资产.

If you have the assets built in your public directory then you can load those assets by assets function.

最后,您应该先了解自己的资产,然后再将其加载到您的网站.我的想法是,您不知道这些资产的来源,因此您不应该首先加载它们.

Lastly, you should know your assets first, before loading them to your site. I get the notion that you don't have any clue where those assets came from, so you shouldn't load them in the first place.

这篇关于未捕获的异常:无法找到混合文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆