h***@163.com
h***@163.com
  • 发布:2019-05-22 10:22
  • 更新:2021-04-19 15:03
  • 阅读:7188

uni-app 编译H5报错,编译小程序没问题,之前都没事,好像更新之后就不行了,麻烦帮忙看看,急

分类:uni-app

10:12:22.582 项目 'haima-h5-uni' 开始编译...
10:12:23.690 INFO Starting development server...
10:12:34.668 Module build failed (from ./node_modules/postcss-loader/src/index.js):
10:12:34.669 SyntaxError
10:12:34.675 (1:5774) Unclosed bracket
10:12:34.686 > 1 | @-webkit-keyframes van-slide-up-enter{0%{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@keyframes van-slide-up-enter{0%{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@-webkit-keyframes van-slide-up-leave{to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@keyframes van-slide-up-leave{to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@-webkit-keyframes van-slide-down-enter{0%{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}}@keyframes van-slide-down-enter{0%{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}}@-webkit-keyframes van-slide-down-leave{to{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}}@keyframes van-slide-down-leave{to{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}}@-webkit-keyframes van-slide-left-enter{0%{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@keyframes van-slide-left-enter{0%{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@-webkit-keyframes van-slide-left-leave{to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@keyframes van-slide-left-leave{to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@-webkit-keyframes van-slide-right-enter{0%{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@keyframes van-slide-right-enter{0%{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@-webkit-keyframes van-slide-right-leave{to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@keyframes van-slide-right-leave{to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@-webkit-keyframes van-fade-in{0%{opacity:0}to{opacity:1}}@keyframes van-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes van-fade-out{0%{opacity:1}to{opacity:0}}@keyframes van-fade-out{0%{opacity:1}to{opacity:0}}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes van-circular{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40}to{stroke-dasharray:90,150;stroke-dashoffset:-120}}@keyframes van-circular{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40}to{stroke-dasharray:90,150;stroke-dashoffset:-120}}@-webkit-keyframes van-notice-bar-play{to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@keyframes van-notice-bar-play{to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@-webkit-keyframes van-notice-bar-play-infinite{to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@keyframes van-notice-bar-play-infinite{to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}html{-webkit-tap-highlight-color:transparent}body{margin:0}a{text-decoration:none}a:focus,button:focus,input:focus,textarea:focus{outline:0}ol,ul{margin:0;padding:0;list-style:none}button,input,textarea{font:inherit;color:inherit}.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-clearfix::after{content:'';display:table;clear:both}[class=van-hairline]{position:relative}[class=van-hairline]::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #ebedf0}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}select:none;position:relative;background-color:#fff;-webkit-text-size-adjust:100%}.van-pickertoolbar{display:-webkit-box;display:-webkit-flex;display:flex;height:44px;line-height:44px;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}.van-pickercancel,.van-pickerconfirm{color:#1989fa;padding:0 15px;font-size:14px}.van-pickercancel:active,.van-pickerconfirm:active{background-color:#f2f3f5}.van-pickertitle{max-width:50%;font-size:16px;font-weight:500;text-align:center}.van-pickercolumns{display:-webkit-box;display:-webkit-flex;display:flex;position:relative}.van-pickerloading{top:0;left:0;right:0;bottom:0;z-index:2;position:absolute;background-color:rgba(255,255,255,.9)}.van-pickerloading circle{stroke:#1989fa}.van-pickerframe,.van-pickerloading .van-loading{top:50%;left:0;width:100%;z-index:1;position:absolute;pointer-events:none;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.van-picker-column{-webkit-box-flex:1;-webkit-flex:1;flex:1;overflow:hidden;font-size:16px;text-align:center}.van-picker-columnitem{padding:0 5px;color:#969799}.van-picker-columnitem--selected{font-weight:500;color:#323233}.van-picker-columnitem--disabled{opacity:.3}.van-pull-refresh{-webkit-user-select:none;user-select:none;overflow:hidden}.van-pull-refreshtrack{position:relative}.van-pull-refreshhead{width:100%;height:50px;left:0;overflow:hidden;position:absolute;text-align:center;top:-50px;font-size:14px;color:#969799;line-height:50px}.van-pull-refreshloading .van-loading{width:16px;height:16px;margin-right:5px}.van-pull-refreshloading .van-loading,.van-pull-refreshloading span{vertical-align:middle;display:inline-block}.van-notify,.van-toast{font-size:14px;line-height:20px;white-space:pre-wrap}.van-notify{text-align:center;padding:6px 15px;box-sizing:border-box}.van-toast{position:fixed;top:50%;left:50%;display:-webkit-box;display:-webkit-flex;display:flex;color:#fff;max-width:70%;border-radius:4px;word-break:break-all;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;box-sizing:content-box;-color:#f44;background:#f44}.van-sku-rowitem--disabled{background:#f2f3f5;border-color:#ebedf0;color:#c8c9cc}.van-sku-stepper-stock{padding:12px 0;margin-left:15px}.van-sku-stepper-container{height:30px;margin-right:20px}.van-skustepper{float:right}.van-skustepper-title{float:left;line-height:30px}.van-skuquota,.van-skustock{display:inline-block;font-size:12px}.van-skustock{margin-right:10px;color:#969799}.van-skuquota{color:#f44}.van-sku-messages{padding-bottom:10px;background:#f8f8f8}.van-sku-messagesimage-cell .van-celltitle{max-width:90px}.van-sku-messagesimage-cell .van-cellvalue{text-align:left}.van-sku-img-uploader{display:inline-block}.van-sku-img-uploaderheader{color:#323233;padding:0 10px;font-size:12px;line-height:24px;border-radius:3px;border:1px solid #ebedf0}.van-sku-img-uploaderheader .van-icon{top:3px;margin-right:5px;font-size:14px}.van-sku-img-uploaderimg{height:60px;width:60px;float:left;margin:10px 10px 0 0;position:relative;border:1px solid #ebedf0}.van-sku-img-uploaderimg img{max-width:100%;max-height:100%;top:50%;position:relative;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.van-sku-img-uploaderdelete{position:absolute;color:#f44;top:-12px;right:-14px;z-index:1;padding:6px}.van-sku-img-uploaderdelete::before{border-radius:14px;background-color:#fff}.van-sku-img-uploader__uploading{position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;width:20px;height:20px}.van-sku-actions{display:-webkit-box;display:-webkit-flex;display:flex}
10:12:35.721 | ^

2019-05-22 10:22 负责人:无 分享
已邀请:
OldKwan

OldKwan - 前端开发

同样是编译 H5的时候报错: Unclosed bracket; 查找后是 vant-weapp 的 icon组件的 css, wxss文件报错; 打开这两个文件后 Shift+alt+F 格式化代码后就ok了(本来只是想 Shift+alt+F 方便看报错位置, 结果突然就不报错了); 仅供参考

  • 机械战警

    引入vant/lib/index.less自行编译就行

    2020-03-09 17:38

2***@qq.com

2***@qq.com


如果是icon/index.wxss文件报错, 图中选中区域的逗号和url之间加个空格就可以了
@DCloud_UNI_FXY

1***@qq.com

1***@qq.com

更新到最新版本就没事了应该,看hbuilderX更新日志:
【uni-app插件】

  • 修复 1.9.7引入的 @-moz-keyframes @-ms-keyframes @-o-keyframes 编译报错 详情 。另注意手机端不应该添加-moz、-ms、-o等前缀语法
  • h***@163.com (作者)

    我现在已经是最新版本了啊,而且里面报错的class样式,我整个项目搜索都找不到

    2019-05-22 10:54

  • h***@163.com (作者)

    我刚才下载了个历史版本1.9.4,编译我的项目没问题,可能是更新到1.9.8的问题

    2019-05-22 11:20

  • 1***@qq.com

    回复 h***@163.com: 那么用cli创建项目的应该怎么办。。。

    2019-06-14 18:00

c***@qq.com

c***@qq.com

同样的问题,h5引入vant会报错,1.9.4正常

  • 1***@qq.com

    那么用cli创建项目的应该怎么办。。。

    2019-06-14 18:00

DCloud_UNI_FXY

DCloud_UNI_FXY

发一个可重现该问题的简单 demo 吧

  • c***@qq.com

    //#ifdef H5

    import Vant from 'vant';

    import 'vant/lib/index.css';

    Vue.use(Vant);

    //#endif

    2019-05-25 18:31

DCloud_UNI_FXY

DCloud_UNI_FXY

临时解决方案

1.使用自定义模板,手动引用 vant 的 css 文件
2.到 node_modules 中将 vant/lib/index.css 格式化一下

  • 1***@qq.com

    格式化没用,使用自定义模板手动引用要怎么操作?

    2019-06-14 17:56

  • DCloud_UNI_FXY

    回复 1***@qq.com: https://uniapp.dcloud.io/collocation/manifest?id=h5-template

    2019-06-14 21:12

  • d***@qq.com

    请问这个问题现在都还没有完全解决吗?

    2021-09-24 17:36

1***@qq.com

1***@qq.com

更新到最新版本就没事了应该,看hbuilderX更新日志:
【uni-app插件】
修复 1.9.7引入的 @-moz-keyframes @-ms-keyframes @-o-keyframes 编译报错 详情 。另注意手机端不应该添加-moz、-ms、-o等前缀语法

h***@163.com

h***@163.com

chunk-vendors.js:12934 Uncaught TypeError: Cannot set property 'render' of undefined
at normalizeComponent (chunk-vendors.js:12934)
at eval (null:10)
at Module.E:\old-peanut-wechat_appletopen_source-new\wx-mall_uniapp\wxcomponents\vant\info\index.vue (index.js:16591)
at
webpack_require (index.js:854)
at fn (index.js:151)
at Object.eval (index.vue:9)
at eval (index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!E:\old-peanut-wechat_applet__open_source-new\wx-mall_uniapp\wxcomponents\vant\icon\index.vue?vue&type=script&lang=js&:43)
at Object../node_modules/babel-loader/lib/index.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js?!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader/index.js!E:\old-peanut-wechat_applet
open_source-new\wx-mall_uniapp\wxcomponents\vant\icon\index.vue?vue&type=script&lang=js& (index.js:10444)
at __webpack_require__ (index.js:854)
at fn (index.js:151)

启动报这个错怎么回事

dcldoud123

dcldoud123

使用 vant/lib/index.less 就好了

该问题目前已经被锁定, 无法添加新回复