msojocs / wechat-web-devtools-linux

适用于微信小程序的微信开发者工具 Linux移植版
MIT License
688 stars 65 forks source link

deepin系统下,打开小程序项目后,默认自动编译报错 #26

Closed sdlddr closed 2 years ago

sdlddr commented 2 years ago

问题描述 deepin系统下,直接下载安装包[WeChat_Dev_Tools_v1.05.2203030-2_deepin_amd64.deb]或[WeChat_Dev_Tools_v1.05.2203030-continuous_deepin_amd64.deb],直接安装,然后载入原来能正常运行的项目,然后发现编译问题。另 复现问题需要进行的操作:

  1. 打开 一个从git上下载的项目,已知该项目在WINDOWS上运行调试均无问题
  2. 看到问题:打开后的自动编译报错: [ WXML 文件编译错误] lazyload parse wxml fail: SyntaxError: Unexpected end of JSON input(env: Windows,mp,1.05.2203030; lib: 2.22.1)

期望的效果 能够在deepin上正常运行编译

截屏 添加截图图片有助于解释您的问题.

版本信息 (这是必要的):

额外的信息 外想问一下,deepin上的这两个安装包,是否为不依赖wine的版本?

msojocs commented 2 years ago

deepin默认不依赖wine; 试试删除~/.config/wechat_devtools; 如果无效:

  1. 项目开源,请提供项目地址
  2. 项目闭源,请提供能复现问题的代码片段。
msojocs commented 2 years ago

点击菜单栏-微信开发者工具-调试-调试微信开发者工具,过滤wcc, 看有什么相关报错。

sdlddr commented 2 years ago

点击菜单栏-微信开发者工具-调试-调试微信开发者工具,过滤wcc, 看有什么相关报错。

好的,先感谢大神的指导,期待您的新版作品,我晚上回家便试

sdlddr commented 2 years ago

刚才我在window上试了1.05.2203030稳定版:也是报错,不过是另一种报错内容,且能具体到详细位置: `[ WXML 文件编译错误] ./miniprogram_npm/@vant/weapp/field/index.wxml ./index.wxs not found from ./miniprogram_npm/@vant/weapp/field/index.wxml 1 |

2 | | ^ 3 | 4 | <van-cell 5 | size="{{ size }}" at files://miniprogram_npm/@vant/weapp/field/index.wxml#2(env: Windows,mp,1.05.2203030; lib: 2.22.0)` 但也是报wxml编译错误的。 如果换成最新的开发版 nightly 1.05.2203032,该问题就消失了,能正常编译并正常模拟 有可能是这个问题引起的:小程序开发时构建npm,打完的包引入组件wxml编译报错

msojocs commented 2 years ago

好的,我下午看报错问题能不能优化一下。

sdlddr commented 2 years ago

微信官方回复说将在下一个版本中修复

msojocs commented 2 years ago

运行vant-demo复现: image

重开项目又没问题了。。。。 image

sdlddr commented 2 years ago

1.05.2203070 这个是官方响应的的反馈,紧急上线的稳定版,新出炉!

msojocs commented 2 years ago

1.05.2203070 这个是官方响应的的反馈,紧急上线的稳定版,新出炉!

收到

sdlddr commented 2 years ago

当前我使用了大神最新发布的1.05.2203070 deepin amd64安装版本,在首次打开时,弹框提示: 无法加载以下来源的扩展程序: . 清单文件缺失或不可读取 进入工具里,载入自己原来的项目后(已知WINDOW同版本上没毛病很正常),在默认编译时报报出更多错误 [ WXML 文件编译错误] Error -1152: WXML file not found: ././components/addr/index>_<9979./components/cart/index>_<9979./components/custSheet/index>_<9979./components/exp/index>_<9979./components/goodsNav/index>_<9979./components/invoice/index>_<9979./components/navBar/index>_<9979./components/price/index>_<9979./components/protocal/index>_<9979./components/shareSheet/index>_<9979./components/sku/components/row-item/index>_<9979./components/sku/index>_<9979./components/topBtn/index>_<9979./components/weappCode/index>_<9979./custom-tab-bar/index>_<9979./index/index>_<9979./miniprogram_npm/@vant/weapp/action-sheet/index>_<9979./miniprogram_npm/@vant/weapp/button/index>_<9979./miniprogram_npm/@vant/weapp/card/index>_<9979./miniprogram_npm/@vant/weapp/cell/index>_<9979./miniprogram_npm/@vant/weapp/cell-group/index>_<9979./miniprogram_npm/@vant/weapp/checkbox/index>_<9979./miniprogram_npm/@vant/weapp/col/index>_<9979./miniprogram_npm/@vant/weapp/count-down/index>_<9979./miniprogram_npm/@vant/weapp/dialog/index>_<9979./miniprogram_npm/@vant/weapp/divider/index>_<9979./miniprogram_npm/@vant/weapp/dropdown-item/index>_<9979./miniprogram_npm/@vant/weapp/dropdown-menu/index>_<9979./miniprogram_npm/@vant/weapp/empty/index>_<9979./miniprogram_npm/@vant/weapp/field/index>_<9979./miniprogram_npm/@vant/weapp/goods-action/index>_<9979./miniprogram_npm/@vant/weapp/goods-action-button/index>_<9979./miniprogram_npm/@vant/weapp/goods-action-icon/index>_<9979./miniprogram_npm/@vant/weapp/grid/index>_<9979./miniprogram_npm/@vant/weapp/grid-item/index>_<9979./miniprogram_npm/@vant/weapp/icon/index>_<9979./miniprogram_npm/@vant/weapp/image/index>_<9979./miniprogram_npm/@vant/weapp/info/index>_<9979./miniprogram_npm/@vant/weapp/loading/index>_<9979./miniprogram_npm/@vant/weapp/nav-bar/index>_<9979./miniprogram_npm/@vant/weapp/notice-bar/index>_<9979./miniprogram_npm/@vant/weapp/overlay/index>_<9979./miniprogram_npm/@vant/weapp/picker/index>_<9979./miniprogram_npm/@vant/weapp/picker-column/index>_<9979./miniprogram_npm/@vant/weapp/popup/index>_<9979./miniprogram_npm/@vant/weapp/row/index>_<9979./miniprogram_npm/@vant/weapp/search/index>_<9979./miniprogram_npm/@vant/weapp/sidebar/index>_<9979./miniprogram_npm/@vant/weapp/sidebar-item/index>_<9979./miniprogram_npm/@vant/weapp/stepper/index>_<9979./miniprogram_npm/@vant/weapp/steps/index>_<9979./miniprogram_npm/@vant/weapp/sticky/index>_<9979./miniprogram_npm/@vant/weapp/submit-bar/index>_<9979./miniprogram_npm/@vant/weapp/swipe-cell/index>_<9979./miniprogram_npm/@vant/weapp/switch/index>_<9979./miniprogram_npm/@vant/weapp/tab/index>_<9979./miniprogram_npm/@vant/weapp/tabs/index>_<9979./miniprogram_npm/@vant/weapp/tag/index>_<9979./miniprogram_npm/@vant/weapp/transition/index>_<9979./miniprogram_npm/@vant/weapp/uploader/index>_<9979./miniprogram_npm/wxml-to-canvas/index>_<9979./pages/address/address>_<9979./pages/category/category>_<9979./pages/discover/discover>_<9979./pages/express/express>_<9979./pages/favorites/shop>_<9979./pages/goods/goodsDetail>_<9979./pages/grades/grades>_<9979./pages/home/home>_<9979./pages/myCart/cart2>_<9979./pages/myCart/myCart>_<9979./pages/order/confirm>_<9979./pages/order/detail>_<9979./pages/order/list>_<9979./pages/pay/pay>_<9979./pages/pay/result>_<9979./pages/postSale/apply>_<9979./pages/postSale/detail>_<9979./pages/postSale/list>_<9979./pages/result/result>_<9979./pages/search/search>_<9979./pages/shop/shopHome>_<9979./pages/shop/shopInfo>_<9979./pages/user/login>_<9979./pages/user/userHome>_<9979./pages/web-view/web-view.wxml (env: Linux,mp,1.05.2203070; lib: 2.22.1)

msojocs commented 2 years ago

还在构建啊? 首次弹窗无视即可,你用的哪一个commit的?

sdlddr commented 2 years ago

continuous版本的

msojocs commented 2 years ago

请提供可复现的基础代码片段; 若不能提供,此问题將滞留至我遇到同一现象为止。

sdlddr commented 2 years ago

怎么说呢,项目中所有的wxml文件,都报错说找不到,包括子组件和page页。 我有个习惯,比如在/pages/aaa/目录中,会放/pages/aaa/bbb,/pages/aaa/ccc,两个以上不同的page页

msojocs commented 2 years ago

怎么说呢,项目中所有的wxml文件,都报错说找不到,包括子组件和page页。 我有个习惯,比如在/pages/aaa/目录中,会放/pages/aaa/bbb,/pages/aaa/ccc,两个以上不同的page页

这个问题不大,我测试的还有/pages/aaa/ddd/ddd.wxml

sdlddr commented 2 years ago

大神,您说的“试试删除~/.config/wechat_devtools;”,是指哪个位置? 所有的WXML都报错说找不到,应该不是项目的原因吧?我把project.config.json文件内容贴出来:

{
  "description": "项目配置文件",
  "packOptions": {
    "ignore": [],
    "include": []
  },
  "setting": {
    "urlCheck": true,
    "es6": true,
    "enhance": false,
    "postcss": true,
    "preloadBackgroundData": false,
    "minified": true,
    "coverView": true,
    "autoAudits": false,
    "showShadowRootInWxmlPanel": true,
    "scopeDataCheck": false,
    "uglifyFileName": false,
    "checkInvalidKey": true,
    "checkSiteMap": true,
    "uploadWithSourceMap": true,
    "compileHotReLoad": false,
    "lazyloadPlaceholderEnable": false,
    "useMultiFrameRuntime": true,
    "useApiHook": true,
    "useApiHostProcess": true,
    "babelSetting": {
      "ignore": [],
      "disablePlugins": [],
      "outputPath": ""
    },
    "useIsolateContext": false,
    "userConfirmedBundleSwitch": false,
    "packNpmManually": true,
    "packNpmRelationList": [
      {
        "packageJsonPath": "./package.json",
        "miniprogramNpmDistDir": "./"
      }
    ],
    "minifyWXSS": true,
    "disableUseStrict": false,
    "minifyWXML": true,
    "showES6CompileOption": false,
    "useCompilerPlugins": false,
    "ignoreUploadUnusedFiles": true
  },
  "compileType": "miniprogram",
  "libVersion": "2.22.1",
  "appid": "wx9146303450145b56",
  "projectname": "minishop-miniprogram",
  "debugOptions": {
    "hidedInDevtools": []
  },
  "scripts": {},
  "watchOptions": {
    "ignore": []
  },
  "staticServerOptions": {
    "servePath": ""
  },
  "condition": {
    "plugin": {
      "list": []
    },
    "game": {
      "list": []
    },
    "gamePlugin": {
      "list": []
    },
    "miniprogram": {
      "list": []
    }
  }
}
msojocs commented 2 years ago

大神,您说的“试试删除~/.config/wechat_devtools;”,是指哪个位置?

~代表HOME目录

sdlddr commented 2 years ago

大神我使用了最新的continuous版本还是报错相同的错,仔细看日志我发现,这些说找不到的wxml文件路径其实都有问题,原来是绝对路径的,前面被硬生生加了个.,而原来../../的相对路径却变成了././,这些都不是我的项目中相关json文件里的写法。

msojocs commented 2 years ago

我建议俺如下操作:

  1. 将项目a拷贝一份b
  2. 在b中新建test页面
  3. 删除b中除了test以外的所有页面
  4. 去除敏感信息
  5. 把处理过的b发出来
sdlddr commented 2 years ago

发现了问题根源,如果在app.json中配置了"lazyCodeLoading": "requiredComponents",就会有以上报错,去掉就正常。linux版对于组件懒加载模式的支持还存在些问题,这个官方的windows同版本号的版本,已经解决过此问题了。不知是否是因为linux版其中一些源码还保留着旧版本留下的,才会有此现象? 另外,我还发现linux版对于“env(safe-area-inset-bottom)”样式的支持缺失了,在windows版本中,模拟器中的苹果手机界面,如果是iphonex及以上,则会在底部的黑条那一层有一段顶出空白的,以防止黑条挡住内容,但linux则直接没有,黑条直接盖住了底部内容

msojocs commented 2 years ago

很高兴,您定位到了问题所在位置; Linux版是不支持懒加载的,懒加载是维护者使用nodejs自行实现的; 如果可以,请提供demo帮助维护者修复此问题。

env问题,控制台有个报错,我测试时看似乎没什么问题,就没管。(默认机型测试的)

sdlddr commented 2 years ago

维护者不就是大神吗?

msojocs commented 2 years ago

问题已定位,但缺少复现代码片段。 编译器随缘修复。

sdlddr commented 2 years ago

问题1:你用自有的测试DEMO项目去试即可,随便加几个自定义子组件到page里,打开"lazyCodeLoading": "requiredComponents"就能复现了。 问题2:page页中写一个fixed定位、有颜色的VIEW,高度设为env(safe-area-inset-bottom),然后在iphhonex以及的模拟器中观看即可。

msojocs commented 2 years ago

组件测试:https://github.com/iMisty/WX-bilibili-Demo 正常 image

env测试有效 image image

msojocs commented 2 years ago

“Talk is cheap. Show me the code.” - Linus Torvalds.