Chunlai

反编译微信小程序$gwx is not defined报错解决方法
错误提示错误提示代码:ReferenceError: $gwx is not defined at vm....
扫描右侧二维码阅读全文
23
2019/02

反编译微信小程序$gwx is not defined报错解决方法

错误提示

1.png

错误提示代码:

ReferenceError: $gwx is not defined
    at vm.js:3:3
    at Script.runInContext (vm.js:107:20)
    at VM.run (D:\wxappUnpacker-master\node_modules\vm2\lib\main.js:208:72)
    at runVM (D:\wxappUnpacker-master\wuWxss.js:69:6)
    at runOnce (D:\wxappUnpacker-master\wuWxss.js:97:27)
    at Array.preRun (D:\wxappUnpacker-master\wuWxss.js:177:5)
    at CntEvent.decount (D:\wxappUnpacker-master\wuLib.js:17:43)
    at ioLimit.runWithCb.err (D:\wxappUnpacker-master\wuLib.js:73:11)
    at agent (D:\wxappUnpacker-master\wuLib.js:54:14)
    at FSReqWrap.oncomplete (fs.js:141:20)

解决方法

修改反编译脚本wuWxss.js代码

将原代码

function runVM(name,code){
    let wxAppCode={},handle={cssFile:name};
    let vm=new VM({sandbox:Object.assign(new GwxCfg(),{__wxAppCode__:wxAppCode,setCssToHead:cssRebuild.bind(handle)})});
    vm.run(code);
    for(let name in wxAppCode)if(name.endsWith(".wxss")){
        handle.cssFile=path.resolve(frameName,"..",name);
        wxAppCode[name]();
    }
}

修改为

function runVM(name,code){
    let wxAppCode={},handle={cssFile:name};
    let gg = new GwxCfg();
    let tsandbox ={$gwx:GwxCfg.prototype["$gwx"],__mainPageFrameReady__:GwxCfg.prototype["$gwx"],__wxAppCode__:wxAppCode,setCssToHead:cssRebuild.bind(handle)};
    let vm = new VM({sandbox:tsandbox});
    vm.run(code);
    for(let name in wxAppCode)if(name.endsWith(".wxss")){
        handle.cssFile=path.resolve(frameName,"..",name);
        wxAppCode[name]();
    }
}

相关教程

Last modification:April 5th, 2019 at 10:45 am
If you think my article is useful to you, please feel free to appreciate

8 comments

  1. 王强

    Splitting "C:\Users\Administrator\Desktop\wxappUnpacker-master\_-1196588801_14\app-service.js" done.
    Guess wxss(first turn)...

    C:\Users\Administrator\Desktop\wxappUnpacker-master\node_modules\vm2\lib\main.js:224
    throw this._internal.Decontextify.value(e);
    ^
    ReferenceError: __vd_version_info__ is not defined
    at vm.js:3:3
    at Script.runInContext (vm.js:134:20)
    at VM.run (C:\Users\Administrator\Desktop\wxappUnpacker-master\node_modules\vm2\lib\main.js:218:62)
    at runVM (C:\Users\Administrator\Desktop\wxappUnpacker-master\wuWxss.js:73:6)
    at runOnce (C:\Users\Administrator\Desktop\wxappUnpacker-master\wuWxss.js:93:27)
    at Array. (C:\Users\Administrator\Desktop\wxappUnpacker-master\wuWxss.js:173:5)
    at CntEvent.decount (C:\Users\Administrator\Desktop\wxappUnpacker-master\wuLib.js:17:43)
    at C:\Users\Administrator\Desktop\wxappUnpacker-master\wuLib.js:73:11
    at agent (C:\Users\Administrator\Desktop\wxappUnpacker-master\wuLib.js:54:14)
    at FSReqCallback.oncomplete (fs.js:153:23)

  2. 爱疯

    感谢分享!!

  3. freedom

    Error: This package is unrecognizable.
    May be this package is a subPackage which should be unpacked with -s=.
    Otherwise, please decrypted every type of file by hand.

    你好请问一下 我这个错误是什么原因啊

  4. 看书

    感谢分享

  5. 名杨

    测试有效。。

  6. 不高兴
    该评论仅登录用户及评论双方可见
    1. Chunlai
      @不高兴

      可以用root了的安卓手机,操作是一样的,可以达到一样的效果。

  7. sjksf

    感谢大佬分享踩坑经验,最近学小程序正需要这个,已完美解决。

Leave a Comment