简体   繁体   English

错误:ENOENT:没有这样的文件或目录,stat Laravel mix bug

[英]Error: ENOENT: no such file or directory, stat Laravel mix bug

I have a tiered folder structure with stylesheets and script files.我有一个包含样式表和脚本文件的分层文件夹结构。 I need to keep the same structure in the output folder.我需要在输出文件夹中保持相同的结构。 For all scripts and styles, I get an array of paths, convert them and give them to the mix.对于所有脚本和样式,我得到一组路径,转换它们并将它们混合。

The problem is that the mix accepts my paths but doesn't create the desired structure.问题是混合接受了我的路径但没有创建所需的结构。 Previously I did the array of paths manually, now I am not getting the right one.以前我手动做了路径数组,现在我没有得到正确的路径。 There are no compiler errors.没有编译器错误。 I still use mix.js(str, str2) and mix.less(str, str2)我仍然使用mix.js(str, str2)mix.less(str, str2)

The paths I received are similar to those that I wrote manually我收到的路径和我手动写的类似

My config 我的配置

But if I start the nodejs debugging process, then I will see但是如果我启动 nodejs 调试过程,那么我会看到

在此处输入图像描述

My folder structure我的文件夹结构

在此处输入图像描述

My array of js paths我的js路径数组

Less array the same as js Less array 和js一样

在此处输入图像描述

在此处输入图像描述

i still dont get my files, but debug error is disappear我仍然没有得到我的文件,但调试错误消失了

 let compileJS = (str, str2) => { console.log(str,str2) mix.js(str, str2); }; glob("./components/**/*.js", (err, files) => { files.map((p) => { pathsJS.push({ in: p, out: p.replace("./components/", "./dist/views/"), }); }); // console.log(pathsJS); pathsJS.map((p) => { compileJS(p.in, p.out); }); });

The problem was that all libraries by default make the issuance of paths an asynchronous method.问题是默认情况下所有库都将路径发布作为异步方法。 Mix works synchronously. Mix 同步工作。 I installed a faster version of the plugin, did the output of paths with synchronous and placed the mix function in the same function.我安装了一个更快版本的插件,同步输出路径并将混合函数放在同一个函数中。 Thus, the code is executed at once.因此,代码立即执行。

 const glob = require("fast-glob"); let compile = () => { function getFilesJS(baseSrc) { return glob.sync("./components/**/*.js", { onlyFiles: true, }); } let filesjs = getFilesJS(); filesjs.map((p) => { pathsJS.push({ in: p, out: p.replace("./components/", "./dist/views/"), }); }); pathsJS.map((p) => { mix.js(p.in, p.out); }); function getFilesLESS() { return glob.sync("./components/**/*.less", { onlyFiles: true, }); } let filesless = getFilesLESS(); filesless.map((p) => { pathsLess.push({ in: p, out: p.replace("./components/", "./dist/views/"), }); }); pathsLess.map((p) => { mix.less(p.in, p.out.replace("style.less", "")); }); mix.less("./src/less/styles.less", "./dist/template_styles.css"); mix.js("./src/js/script.js", "./dist/script.js"); };

In my case there was two bugs with nodejs and broken symlink to storage (after moving project folder into other place) (laravel 8).在我的例子中,有两个 nodejs 错误和损坏的存储符号链接(将项目文件夹移动到其他地方后)(laravel 8)。 So what i've done:所以我做了什么:

  1. Removed storage symlink and php artisan storage:link删除了存储符号链接和php artisan storage:link
  2. Downgraded nodejs version from 18 to 14:将 nodejs 版本从 18 降级到 14:
$ node -v
18.12.1
$ n 14.21.2
installed
$ node -v
14.21.2

暂无
暂无

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

相关问题 错误:ENOENT:没有这样的文件或目录,统计 - Error: ENOENT: no such file or directory, stat 错误:ENOENT:没有这样的文件或目录,stat ... .steampath - Error: ENOENT: no such file or directory, stat ... .steampath 错误:ENOENT:没有这样的文件或目录,stat '/home/arpit/.steampath' - Error: ENOENT: no such file or directory, stat '/home/arpit/.steampath' UnhandledPromiseRejectionWarning:错误:ENOENT:没有这样的文件或目录,stat'/assets/level.png' - UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/assets/level.png' 错误:Enoent:没有这样的文件或目录,状态为'D:\\ awesome-testindex.html' - Error :Enoent :no such file or directory ,stat 'D:\awesome-testindex.html' 错误:ENOENT:没有这样的文件或目录 - Error: ENOENT: no such file or directory 当我导入 BrowserRouter 时,在 reactJS 中遇到此错误“错误:ENOENT:没有此类文件或目录,stat '/initrd.img'” - Encountering this error "Error: ENOENT: no such file or directory, stat '/initrd.img'" in reactJS when i import BrowserRouter 错误:ENOENT:没有这样的文件或目录,错误时统计“/public/main.html”(本机) - Error: ENOENT: no such file or directory, stat '/public/main.html' at Error (native) webpack + express + angular 4错误“错误:ENOENT:没有这样的文件或目录,统计信息'C:\\ public \\ index.html' - webpack + express + angular 4 error "Error: ENOENT: no such file or directory, stat 'C:\public\index.html' 服务器给出错误:ENOENT:没有这样的文件或目录,stat 'F:\\web development\\calculator\\index.html' - server is giving Error: ENOENT: no such file or directory, stat 'F:\web development\calculator \index.html '
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM