简体   繁体   English

Angular 离子构建:无法读取未定义 postcss 的属性“toLowerCase”

[英]Angular ionic build: Cannot read property 'toLowerCase' of undefined postcss

I'm trying to build my application, but I'm getting this error from Postcss.我正在尝试构建我的应用程序,但我从 Postcss 收到此错误。

Note: the file on '/srv/http/r2-app/styles.e4dd05dfea4b7f17f938.css' does not exist.注意:“/srv/http/r2-app/styles.e4dd05dfea4b7f17f938.css”上的文件不存在。

[error] TypeError: Cannot read property 'toLowerCase' of undefined
    at /srv/http/r2-app/styles.e4dd05dfea4b7f17f938.css:50691:1
    at hasInherit (/srv/http/r2-app/node_modules/postcss-merge-longhand/dist/lib/canMerge.js:16:39)
    at Array.some (<anonymous>)
    at _default (/srv/http/r2-app/node_modules/postcss-merge-longhand/dist/lib/canMerge.js:23:13)
    at /srv/http/r2-app/node_modules/postcss-merge-longhand/dist/lib/decl/borders.js:234:33
    at mergeRules (/srv/http/r2-app/node_modules/postcss-merge-longhand/dist/lib/mergeRules.js:44:11)
    at /srv/http/r2-app/node_modules/postcss-merge-longhand/dist/lib/decl/borders.js:233:29
    at Array.forEach (<anonymous>)
    at Object.merge (/srv/http/r2-app/node_modules/postcss-merge-longhand/dist/lib/decl/borders.js:231:7)
    at /srv/http/r2-app/node_modules/postcss-merge-longhand/dist/index.js:20:13
    at Array.forEach (<anonymous>)
    at /srv/http/r2-app/node_modules/postcss-merge-longhand/dist/index.js:18:23
    at /srv/http/r2-app/node_modules/postcss/lib/container.js:115:18
    at /srv/http/r2-app/node_modules/postcss/lib/container.js:74:18
    at Root.each (/srv/http/r2-app/node_modules/postcss/lib/container.js:60:16)
    at Root.walk (/srv/http/r2-app/node_modules/postcss/lib/container.js:71:17)
    at Root.walkRules (/srv/http/r2-app/node_modules/postcss/lib/container.js:113:19)

Version details版本详情在此处输入图像描述

  1. Build your application on local machine in development mode with "optimization": true set in your angular.json.使用“优化”在开发模式下在本地计算机上构建您的应用程序:在您的 angular.json 中设置为 true。 This is needed for more convenient debugging.这是为了更方便的调试所必需的。

  2. Open your style.css file generated in the dist folder and inspect it for errors (in case you're developing in docker container, copy this file from the container to host).打开您在dist文件夹中生成的 style.css 文件并检查它是否有错误(如果您在 docker 容器中开发,请将此文件从容器复制到主机)。

  3. When you find syntax errors like this:当你发现这样的语法错误时: 在此处输入图像描述 try to match the erroneous code in the generated style.css with your source code and fix the issue / issues there.尝试将生成的 style.css 中的错误代码与您的源代码相匹配,并修复那里的问题/问题。

In my case the original code looked like this:就我而言,原始代码如下所示: 在此处输入图像描述 where darker is a non-existing palette color which I changed to main (existing one) and that was the fix.其中darker的是不存在的调色板颜色,我将其更改为main (现有的),这就是修复。 Similar fix was for fill: !important .类似的修复是fill: !important

Angular has optimization flag in angular.json if you set it to true, minificaiton css also happens. Angular 在 angular.json 中具有优化标志,如果将其设置为 true,则会发生缩小 ZC7A628CBA262E28EB17AE6A5A5F。

In my case it was very stupid mistake in tailwind.config.js and not in any css class.就我而言,tailwind.config.js 中的错误非常愚蠢,而 css class 中则没有。 Ultimately Tailwind generates bunch of classes only最终 Tailwind 只生成一堆类

   grey: {
    50: '#d8d8d8',
    200: '#8d8d8d',
    300: '#3a3a3f',
    400: '#252b3d',
    500: '#242837',
    600: '#222434',
    700: '#1b1d29',
    800: '' --------------------> silly mistake which failed minifycss
  },

If you have tailwind integrated and can't find problem in css, check your tailwind config file:)!如果您集成了 tailwind 并且在 css 中找不到问题,请检查您的 tailwind 配置文件:)!

I was using angular metronic.我正在使用 angular metronic。 I got the same error and after a long time I found the wrong code block and commented it.我得到了同样的错误,很长一段时间后我发现了错误的代码块并对其进行了注释。 error fixed.错误已修复。

border-width: get($checkbox-config, types, accent, borderWidth);important;边框宽度:get($checkbox-config,类型,重音,边框宽度);重要;

metronic css合并错误

暂无
暂无

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

相关问题 TypeError:无法读取未定义的Ionic 3的属性“ toLowerCase” - TypeError: Cannot read property 'toLowerCase' of undefined Ionic 3 Angular 生产构建错误“无法读取未定义的属性'toLowerCase'中的错误” - Angular Production build error "ERROR in Cannot read property 'toLowerCase' of undefined" Angular,TypeError:无法读取未定义的属性&#39;toLowerCase&#39; - Angular, TypeError: Cannot read property 'toLowerCase' of undefined Angular 4管道无法读取未定义的属性“ toLowerCase” - Angular 4 pipe Cannot read property 'toLowerCase' of undefined 无法读取未定义Angular 5的属性“ toLowerCase” - Cannot read property 'toLowerCase' of undefined Angular 5 Angular:TypeError:无法读取未定义的属性“toLowerCase” - Angular: TypeError: Cannot read property 'toLowerCase' of undefined ng 构建消息“无法读取未定义的属性 &#39;toLowerCase&#39; 中的错误” - ng build message "ERROR in Cannot read property 'toLowerCase' of undefined" Angular 5:错误类型错误:无法读取未定义的属性“toLowerCase” - Angular 5 : ERROR TypeError: Cannot read property 'toLowerCase' of undefined 过滤产品时无法读取 angular 中未定义的属性“toLowerCase” - Cannot read property 'toLowerCase' of undefined in angular when filtering products Angular 6:ERROR TypeError:无法读取未定义的属性&#39;toLowerCase&#39; - Angular 6: ERROR TypeError: Cannot read property 'toLowerCase' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM