解决 : ValidationError: Invalid options object. PostCSS Loader ......

Posted 雨季mo浅忆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决 : ValidationError: Invalid options object. PostCSS Loader ......相关的知识,希望对你有一定的参考价值。

问题背景 :

    使用 vue/cli @5.x 脚手架工具搭建一个初始化项目架子,在 vue.config.js 里面 配置 移动端 的 适配性插件( postcss-pxtorem )的代码时,运行启动项目时报错如下图 :

Compiled with problems:

ERROR in './xxx/xx'

Module build failed (from './xxx/xx'):

        ValidationError: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.

- options has an unknown property 'plugins'. These properties are valid:

   object postcssOptions?, execute?, sourceMap?, implemntation?


编译时出现问题:
'./xxx/xx' 中出现错误
模块生成失败(来自“./xxx/xx”):
        ValidationError:选项对象无效。PostCSS Loader 已使用与 API 架构不匹配的选项对象进行初始化。
- 选项具有未知属性“plugins”。这些特性有效:

    objectpostssOptions?,execute?,sourceMap?,implementation?



各种百度解决 :


1、首先打开终端执行  npm uninstall @vue/cli -g  卸载掉当前 5.x 的版本( mac 版本 的前面需要加上 sudo )

2、接着执行  npm install -g @vue/cli@4  直接下载 @4 版本( mac 版本 的 前面需要加上 sudo )
vue --version  这时候看到 vue-cli 已经是 @4 版本的了

最后再按照创建项目的步骤重新走一遍就 OK 了 

解决django.core.exceptions.ValidationError: [“‘‘ value has an invalid date format. It must be in YYYY-

django.core.exceptions.ValidationError: ["'' value has an invalid date format. It must be in YYYY-MM-DD format."]

说明下,报这个错的原因是django使用DateField()或者DateTimeField()时设置了default='',有时系统会自动填充'',由于是空字符串不符合时间类型。

解决办法:

 you have to delete all migrations and erase your database data too and do migrations again

python manage.py makemigrations


python manage.py migrate --fake

建议设置时间类型字段时:

createtime = models.DateTimeField(blank=True,null=True,default=datetime.date(1900,1,1) verbose_name='创建时间')

以上是关于解决 : ValidationError: Invalid options object. PostCSS Loader ......的主要内容,如果未能解决你的问题,请参考以下文章

Django提升表单ValidationError不起作用

Mac连接以太网 报无效的服务器地址 BasicIPv6ValidationError

Mac连接以太网 报无效的服务器地址 BasicIPv6ValidationError

Laravel Mix: ValidationError: CSS Loader has been initialized using an options object that does not

表单 ValidationError 和错误代码

ValidationError:验证失败猫鼬