收藏
回答

开发工具真机调试时报错,无法明确定位问题所在?

开发工具预览和发布的体验版都没有问题,只是真机调试时报错,通过报错信息不知道该如何去定位问题,求教

message:Error: 非法的文件,错误信息:invalid file: common/vendor.js, undefined:19267: SyntaxError: Unexpected eval or arguments in strict mode,    _3(53, 19267, 11), function (e3, t3, n2) {var _args1905 = arguments;return _$(function () {var arguments = _args1905;__(function (_e2041) {return eval(_e2041);});                                                                                                   ^^^^^^^^^SyntaxError: Unexpected eval or arguments in strict mode [20220321 15:21:15][wxbeb15d45ba19475f]

appid: wxbeb15d45ba19475f

openid: o6zAJsz_sZlPkoyGHyqiqdIBFjHA

ideVersion: 1.06.2111300

osType: darwin-x64

time: 2022-03-21 15:23:21


回答关注问题邀请回答
收藏

2 个回答

  • 工号 9527
    工号 9527
    2022-03-21

    这个文件有 es6 语法,请先转成 es5 的

    2022-03-21
    有用
    回复 4
    • 里里昂
      里里昂
      2022-03-21
      cli 压缩代码,真机调试报错。


      message:Error: 非法的文件,错误信息:invalid file: common/vendor.js, undefined:1182: SyntaxError: Unexpected eval or arguments in strict mode, \***********************************************************/ /*! exports provided: default */function (e, t, n) {var _args937 = arguments;return $(function () {var arguments = _args937;__(function (_e991) {return eval(_e991);});_(4, 89, 61), n.r(t), _(4, 89, 68), n.d(t, "default", function () {var _args934 = arguments;return $(function () {var arguments = _args934;__(function (_e992) {return eval(_e992);});_(4, 89, 96);var _tmp465;return _tmp465 = u, _(4, 89, 104), _tmp465;_(4, 89, 89);}.bind(this), 1003)();});_(4, 89, 108);var r = n( /*! ./dispatchRequest */25),a = n( /*! ./InterceptorManager */33),i = n( /*! ./mergeConfig */34),s = n( /*! ./defaults */35),o = n( /*! ../utils */28);class u {constructor(e = {}) {var _tmp466;_(4, 89, 281), (_tmp466 = Object(o["isPlainObject"]), _(4, 89, 307), _tmp466)(e) || (_(4, 89, 313), e = {}, _(4, 89, 318), console.warn("设置全局参数必须接收一个Object")), _(4, 89, 354), this.config = { ...s["default"], ...e }, _(4, 89, 389), this.interceptors = { request: new a["default"](), response: new a["default"]() };}setConfig(e) {_(4, 89, 473);this.config = e(this.config);}middleware(e) {var _tmp467;_(4, 89, 514);e = (_tmp467 = Object(i["default"]), _(4, 89, 536), _tmp467)(this.config, e);_(4, 89, 552);let t = [r["default"], void 0],n = Promise.resolve(e);_(4, 89, 601), this.interceptors.request.forEach(function (e) {var _args935 = arguments;return $(function () {var arguments = _args935;__(function (_e993) {return eval(_e993);});_(4, 89, 648);t.unshift(e.fulfilled, e.rejected);_(4, 89, 89);}.bind(this), 1004)();}), _(4, 89, 685), this.interceptors.response.forEach(function (e) {var _args936 = arguments;return $(function () {var arguments = _args936;__(function (_e994) {return eval(_e994);});_(4, 89, 733);t.push(e.fulfilled, e.rejected);_(4, 89, 89);}.bind(this), 1005)();});while (_(4, 89, 773), t.length) {_(4, 89, 782);n = n.then((_(4, 89, 791), t.shift()), (_(4, 89, 801), t.shift()));}_(4, 89, 812);return _tmp467 = n, _(4, 89, 820), _tmp467;}request(e = {}) {_(4, 89, 835);var _tmp468;return _tmp468 = this.middleware(e), _(4, 89, 860), _tmp468;}get(e, t = {}) {_(4, 89, 873);var _tmp469;return _tmp469 = this.middleware({ url: e, method: "GET", ...t }), _(4, 89, 922), _tmp469;}post(e, t, n = {}) {_(4, 89, 938);var _tmp470;return _tmp470 = this.middleware({ url: e, data: t, method: "POST", ...n }), _(4, 89, 995), _tmp470;}put(e, t, n = {}) {_(4, 89, 1010);var _tmp471;return _tmp471 = this.middleware({ url: e, data: t, method: "PUT", ...n }), _(4, 89, 1066), _tmp471;}delete(e, t, n = {}) {_(4, 89, 1084);var _tmp472;return _tmp472 = this.middleware({ url: e, data: t, method: "DELETE", ...n }), _(4, 89, 1143), _tmp472;}connect(e, t, n = {}) {_(4, 89, 1162);var _tmp473;return _tmp473 = this.middleware({ url: e, data: t, method: "CONNECT", ...n }), _(4, 89, 1222), _tmp473;}head(e, t, n = {}) {_(4, 89, 1238);var _tmp474;return _tmp474 = this.middleware({ url: e, data: t, method: "HEAD", ...n }), _(4, 89, 1295), _tmp474;}options(e, t, n = {}) {_(4, 89, 1314);var _tmp475;return _tmp475 = this.middleware({ url: e, data: t, method: "OPTIONS", ...n }), _(4, 89, 1374), _tmp475;}trace(e, t, n = {}) {_(4, 89, 1391);var _tmp476;return _tmp476 = this.middleware({ url: e, data: t, method: "TRACE", ...n }), _(4, 89, 1449), _tmp476;}upload(e, t = {}) {_(4, 89, 1465);var _tmp477;return _tmp477 = (_(4, 89, 1472), t.url = e, _(4, 89, 1480), t.method = "UPLOAD", _(4, 89, 1498), this.middleware(t)), _(4, 89, 1516), _tmp477;}download(e, t = {}) {_(4, 89, 1534);var _tmp478;return _tmp478 = (_(4, 89, 1541), t.url = e, _(4, 89, 1549), t.method = "DOWNLOAD", _(4, 89, 1569), this.middleware(t)), _(4, 89, 1587), _tmp478;}}_(4, 89, 89);}.bind(this), 1006)();}, /*!*******************************************************************!*\ ^^^^^^^^^SyntaxError: Unexpected eval or arguments in strict mode [20220321 17:31:28][wx9a9f30b5175961d2]
      appid: wx9a9f30b5175961d2
      openid: o6zAJs_UjdhxjKdBtoR4qgQ_Xx6Y
      ideVersion: 1.05.2201240
      osType: win32-x64
      time: 2022-03-21 17:31:31
      2022-03-21
      1
      回复
    • 工号 9527
      工号 9527
      2022-03-21回复里里昂
      2022-03-21
      回复
    • 好久不见
      好久不见
      2022-04-01
      message:Error: 非法的文件,错误信息:invalid file: app.js, undefined:1: SyntaxError: Unexpected token {,import{ajax as e}from"./utils/index";App({globalData:{userInfo:{},locationInfo:{cityCode:"000"}},onLaunch(){wx.getSystemInfo({success:e=>{console.log(e),wx.setStorage({key:"PLAT_INFO",data:e.version}),wx.setStorage({key:"PLAT_TYPE",data:"wx"}),wx.setStorage({key:"USER_DEVICE_ID",data:e.system})}}),e({url:"/user/info",success:e=>{this.globalData.userInfo=e.data}})}}); ^SyntaxError: Unexpected token { [20220401 17:19:01][wx5a37bf80c095ce8c]
      appid: wx5a37bf80c095ce8c
      openid: o6zAJs8gP1HVFn74h0Wx40W0aPkg
      ideVersion: 1.05.2107090
      osType: darwin-x64
      time: 2022-04-01 17:19:45
      2022-04-01
      回复
    • 思远
      思远
      2023-03-07
      es5也是如上提示
      2023-03-07
      回复
  • 里里昂
    里里昂
    2022-03-21

    请问博主解决了吗?我这边也遇到这个问题了。

    2022-03-21
    有用
    回复 3
    • look at you ~
      look at you ~
      2022-03-21
      使用uniapp开发的么,是的话在运行的时候把压缩代码勾上,然后真机调试就不报错了
      2022-03-21
      回复
    • 里里昂
      里里昂
      2022-03-21回复look at you ~
      用的uniapp的框架,用命令行跑的项目 npm run dev:mp-weixin,然后dist中找到weixin端的包导入开发者工具
      2022-03-21
      回复
    • T
      T
      2023-02-09回复里里昂
      dev环境不能在开发者工具打包上传,即使勾选压缩也不行。需要npm run build:mp-weixin,再导入dist中的build/mp-weixin到开发者工具即可上传和真机预览
      2023-02-09
      回复
登录 后发表内容