当我用laravel微风运行npm时出现节点错误 [英] Node error when I run npm with laravel breeze

查看:66
本文介绍了当我用laravel微风运行npm时出现节点错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 npm run dev npm run watch 时出现此错误,但我没有发现一团糟.这是在全新的Laravel 8应用中发生的.

I have this error when I run npm run dev or npm run watch and I didn't find what is the mess. It's happens in a all fresh Laravel 8 app.

使用开发命令时似乎会发生

It looks like happen when I use the developement command

ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: [(...variantsValue),(...extensions)].flat is not a function
    at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:219:73
    at baseMergeDeep (/var/www/html/smart_recipe/node_modules/lodash/_baseMergeDeep.js:42:7)
    at /var/www/html/smart_recipe/node_modules/lodash/_baseMerge.js:27:7
    at /var/www/html/smart_recipe/node_modules/lodash/_createBaseFor.js:17:11
    at baseMerge (/var/www/html/smart_recipe/node_modules/lodash/_baseMerge.js:24:3)
    at /var/www/html/smart_recipe/node_modules/lodash/mergeWith.js:36:3
    at /var/www/html/smart_recipe/node_modules/lodash/_createAssigner.js:30:9
    at apply (/var/www/html/smart_recipe/node_modules/lodash/_apply.js:15:25)
    at /var/www/html/smart_recipe/node_modules/lodash/_overRest.js:32:12
    at mergeVariantExtensions (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:218:33)
    at resolveVariants (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:235:10)
    at resolveConfig (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:271:15)
    at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/index.js:77:37
    at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/processTailwindFeatures.js:52:20
    at LazyResult.run (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:288:14)
    at LazyResult.asyncTick (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:212:26)
    at LazyResult.asyncTick (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:225:14)
    at /var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:217:17
    at runLoaders (/var/www/html/smart_recipe/node_modules/webpack/lib/NormalModule.js:316:20)
    at /var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Promise.resolve.then.then.catch (/var/www/html/smart_recipe/node_modules/postcss-loader/src/index.js:208:9)
 @ ./resources/css/app.css

推荐答案

我遇到了同样的问题,花了5个小时来寻找解决方案,但没有.搜索了很多之后,我偶然发现了这个

I came across same issue and spent 5 hours on finding solution but could not. After searching alot, I came across this

"Tailwind CSS v2.0不再支持Node.js 8或10.要构建CSS,您需要确保在本地和CI环境中都运行Node.js 12.13.0或更高版本.";

"Tailwind CSS v2.0 no longer supports Node.js 8 or 10. To build your CSS you'll need to ensure you are running Node.js 12.13.0 or higher in both your local and CI environments."

https://tailwindcss.com/docs/upgrading-to-v2

所以我意识到问题出在我的Node版本是10.x,所以我从Windows计算机上卸载了Node,并下载了LTS版本(14.x).因此,请考虑更新您的Node版本,因为它确实对我有用,因此可以解决该问题.旧节点版本可能没有Tailwind CSS 2实现的扁平函数,并且会引发错误.

So I realized that issue was in my Node version which was 10.x so I uninstalled Node from my windows machine and downloaded LTS version (14.x). So consider updating your Node version, it will solve the issue as it did work for me. There is possibility that old node versions don't have that flat function that Tailwind CSS 2 has implemented and that's throwing error.

这篇关于当我用laravel微风运行npm时出现节点错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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