5***@qq.com
5***@qq.com
  • 发布:2022-06-27 09:23
  • 更新:2022-09-16 17:59
  • 阅读:1215

【报Bug】APP打包提示:Unexpected token: punc (,)

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: macOS Monterey 12.0.1

HBuilderX版本号: 3.4.15

示例代码:

<u--form></u--form>

操作步骤:

新建项目,设置为纯nvue项目,安装uview2.0,任意页面写入 <u--form></u--form>
然后打包、热更新包都会报错
Unexpected token: punc (,) [pages/index/index.js:1921,317]
但直接运行不会报错

预期结果:

能够正常打包

实际结果:

不要有这个错误提示Unexpected token: punc (,)

bug描述:

回退到3.4.7版本就没问题,项目是vue2的之前一直都是正常的,但更新到3.4.15就不能打包了
从这个帖子里来看,遇到这个问题的人还不少
https://ask.dcloud.net.cn/question/147772

2022-06-27 09:23 负责人:无 分享
已邀请:
芜湖老码农

芜湖老码农

找到原因了,调用了process.env就会出现这个,uview中也有调用。

  • 5***@qq.com (作者)

    大佬牛批,感谢分享

    2022-07-07 09:23

5***@qq.com

5***@qq.com (作者)

以下是运行日志,清空后进行打包后的日志

2022-06-27 09:18:12.811 [INFO:] mFilePath: "/Users/me/app/scanf-app" --mode: 0  
2022-06-27 09:18:13.228 [WARNING:] [Expression]  "Unsupport Expr : unicloud.canShowClientDBActionDeleteFiles"  
2022-06-27 09:18:21.547 [INFO:] [PluginHost] 正在激活插件h5-Extension...  
2022-06-27 09:18:21.566 [INFO:] [PluginHost] 插件h5-Extension激活成功。  
2022-06-27 09:18:24.513 [INFO:] node "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/node/node"  
2022-06-27 09:18:24.513 [INFO:] args ("--max-old-space-size=2048", "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/bin/uniapp-cli.js")  
2022-06-27 09:18:47.978 [INFO:] [PluginHost] 正在激活插件app-safe-pack...  
2022-06-27 09:18:47.979 [WARNING:] [PluginHost] Plugin [app-safe-pack] has already activated,won't activate again.  

2022-06-27 09:18:47.980 [INFO:] [PluginHost] 插件app-safe-pack激活成功。  
2022-06-27 09:19:58.977 [INFO:] DevTools Debugging port:  9777  
2022-06-27 09:19:59.604 [WARNING:] Remote debugging server started successfully. Try pointing a Chromium-based browser to http://127.0.0.1:9777  
2022-06-27 09:20:00.842 [WARNING:] Color:  is invalid using fallback #000000  
DCloud_UNI_GSQ

DCloud_UNI_GSQ

项目的详细信息能发补充一下,方便复现问题。

  • DCloud_UNI_GSQ

    回复 5***@qq.com: 这两个替换到默认模版里可以复现吗?

    2022-06-28 17:20

  • 5***@qq.com (作者)

    你好,破案了,刚才一点点的删除代码来测试发现,3.4.15版本只要用了<u--form></u--form>打包就会报错

    2022-06-29 15:33

  • 5***@qq.com (作者)

    复现流程:新建项目,设置为纯nvue项目,安装uview2.0,任意页面写入<u--form></u--form>就会报错

    2022-06-29 15:40

芜湖老码农

芜湖老码农

要命,很多天了,这个问题一直没人解决。我这没用这个uview也报这个错。

DCloud_UNI_GSQ

DCloud_UNI_GSQ

HBuilderX 3.5.2 alpha 已修复

  • 5***@qq.com (作者)

    好的 幸苦!

    2022-07-21 09:25

  • 5***@qq.com (作者)

    我发现新版本仍然存在这个问题,我现在是3.6.1只有打开虫子调试控制台后,才能读取到process.env,在不开启调试控制台的情况下,process.env仍然是不存在的

    2022-09-19 10:03

  • DCloud_UNI_GSQ

    回复 5***@qq.com: 之前版本是否正常?

    2022-09-19 15:59

s***@163.com

s***@163.com

我也是这个问题,不知道怎么解决

  • DCloud_UNI_GSQ

    是什么?

    2022-09-19 15:58

  • s***@163.com

    回复 DCloud_UNI_GSQ: 这个问题解决了,怎么是运行到安卓基座,查找不到设备,

    2022-09-20 09:23:11.262 [WARNING:] [PluginHost] Error Code (PluginHost): -32603

    2022-09-20 09:23:11.268 [WARNING:] [PluginHost] Error Stack (PluginHost):

    2022-09-20 09:23:11.270 [WARNING:] [PluginHost] Request plugin/invokeApi failed unexpectedly without providing any details.

    2022-09-20 09:23:11.328 [WARNING:] [PluginHost] refreshListData: QJsonValue(undefined)

    2022-09-20 09:24:00.354 [WARNING:] QLayout: Cannot add a null widget to QVBoxLayout/

    2022-09-20 09:24:00.357 [WARNING:] QLayout: Attempting to add QLayout "" to ExtFormDialog "", which already has a layout

    2022-09-20 09:24:00.359 [WARNING:] QLayout: Attempting to add QLayout "" to ExtFormDialog "", which already has a layout

    2022-09-20 09:24:03.009 [WARNING:] [PluginHost] Error Code (PluginHost): -32603

    2022-09-20 09:24:03.013 [WARNING:] [PluginHost] Error Stack (PluginHost):

    2022-09-20 09:24:03.016 [WARNING:] [PluginHost] Request plugin/invokeApi failed unexpectedly without providing any details.

    2022-09-20 09:24:03.056 [WARNING:] [PluginHost] refreshListData: QJsonValue(undefined)

    2022-09-20 09:24:37.954 [WARNING:] [MENU] !!!Can't find the action id: "unicloud.localRunOrStop"

    2022-09-20 09:28:22.714 [WARNING:] QLayout: Cannot add a null widget to QVBoxLayout/

    2022-09-20 09:28:22.717 [WARNING:] QLayout: Attempting to add QLayout "" to ExtFormDialog "", which already has a layout

    2022-09-20 09:28:22.719 [WARNING:] QLayout: Attempting to add QLayout "" to ExtFormDialog "", which already has a layout

    2022-09-20 09:29:10.956 [WARNING:] [PluginHost] Error Code (PluginHost): -32603

    2022-09-20 09:29:10.960 [WARNING:] [PluginHost] Error Stack (PluginHost):

    2022-09-20 09:29:10.962 [WARNING:] [PluginHost] Request plugin/invokeApi failed unexpectedly without providing any details.

    2022-09-20 09:29:11.031 [WARNING:] [PluginHost] refreshListData: QJsonValue(undefined)

    2022-09-20 09:29

要回复问题请先登录注册