uni-app 最新版3.4.6.20220416-alpha 依然编译报错

uni-app 最新版3.4.6.20220416-alpha 依然编译报错

类别 信息
产品分类 uniapp/App
PC开发环境 Mac
PC版本号 12.3.1
开发工具 HBuilderX
工具版本号 Alpha 3.4.6
手机系统 全部
手机厂商 华为
页面类型 nvue
Vue版本 vue3
打包方式 云端
项目创建方式 HBuilderX

测试过的手机

  • ios
  • 小米

示例代码

12:08:20.258 Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
12:08:20.264 Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
12:08:20.771 [plugin:vite:css] /Users/biubiubiubliud/Documents/HBuilderProjects/juzhengyinqing/pages/tabbar/home/page/taskList/taskList.nvue?used&vue&type=style&index=0&inline&lang.css:4:6: Unknown word
12:08:20.776 at pages/tabbar/home/page/taskList/taskList.nvue:1:0
12:08:20.973 [plugin:vite:nvue-css] ERROR: property value `transparent !important` is not valid for `background-color`
12:08:20.978 41 |  .fui-button-link {
12:08:20.979 42 |       border-color:transparent !important;
12:08:20.992 43 |       background:transparent !important;
12:08:20.992    |     ^
12:08:21.009 44 |  }
12:08:21.018 45 |  .fui-button-primary {
12:08:21.018 at components/firstui/fui-button/fui-button.vue:1:0
...

操作步骤

12:08:20.258 Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
12:08:20.264 Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
12:08:20.771 [plugin:vite:css] /Users/biubiubiubliud/Documents/HBuilderProjects/juzhengyinqing/pages/tabbar/home/page/taskList/taskList.nvue?used&vue&type=style&index=0&inline&lang.css:4:6: Unknown word
12:08:20.776 at pages/tabbar/home/page/taskList/taskList.nvue:1:0
12:08:20.973 [plugin:vite:nvue-css] ERROR: property value `transparent !important` is not valid for `background-color`
12:08:20.978 41 |  .fui-button-link {
12:08:20.979 42 |       border-color:transparent !important;
12:08:20.992 43 |       background:transparent !important;
12:08:20.992    |     ^
12:08:21.009 44 |  }
12:08:21.018 45 |  .fui-button-primary {
12:08:21.018 at components/firstui/fui-button/fui-button.vue:1:0
...

预期结果

  • 不报错,能正常编译

实际结果

  • 报错,无法正常编译,样式丢失

bug描述

  • 编译报以下错误,从上个版本开始,我本以为这个版本能解决,可是还是依然报错。目前我只能使用非alpha版本了

更多关于uni-app 最新版3.4.6.20220416-alpha 依然编译报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

你确定 nvue 支持 !important?

更多关于uni-app 最新版3.4.6.20220416-alpha 依然编译报错的实战教程也可以访问 https://www.itying.com/category-93-b0.html


支持的 亲~ 3.1.2和之前版本我这样写没有任何问题

2022-8-10 遇到一样的问题 hbuilderX 3.5.3 运行到H5 没问题 运行到APP 会报这个

uni-app 的最新版本 3.4.6.20220416-alpha 中,如果你仍然遇到编译报错,可以尝试以下步骤来排查和解决问题:

1. 检查依赖版本

确保你的项目依赖是最新的,特别是 uni-app 相关的依赖。你可以通过以下命令更新依赖:

npm install

或者使用 yarn

yarn install

2. 清理缓存

有时候缓存可能会导致编译问题,尝试清理缓存并重新编译:

npm cache clean --force

或者使用 yarn

yarn cache clean

然后重新安装依赖并编译项目。

3. 检查 node_modulespackage-lock.json

删除 node_modulespackage-lock.json 文件,然后重新安装依赖:

rm -rf node_modules package-lock.json
npm install

或者使用 yarn

rm -rf node_modules yarn.lock
yarn install
回到顶部