creator 1.6 模拟器无法启动

creator 1.6 启动模拟器完全黑屏 ,浏览器正常

但是build之后,用xcode打开,运行desktop又可以正常。windows也一样用模拟器打不开

新建项目是没问题的,我不太理解 ScriptingCore:: compileScript fail:buffer这个是到底是什么

08-17T07:13:58.139Z - normal: Simulator: WORKAREA WIDTH 1920.00, HEIGHT 947.00
2017-08-17T07:13:58.139Z - normal: Simulator: FRAME SCALE = 1.00
2017-08-17T07:13:58.169Z - normal: Simulator: GLFWError #65544 Happen, Cocoa: Failed to retrieve display name
2017-08-17T07:13:58.342Z - normal: Simulator: 
2017-08-17T07:13:58.343Z - normal: Simulator: {
2017-08-17T07:13:58.343Z - normal: Simulator: 	gl.supports_OES_map_buffer: false
2017-08-17T07:13:58.343Z - normal: Simulator: 	gl.supports_vertex_array_object: true
2017-08-17T07:13:59.383Z - normal: Simulator: 	cocos2d.x.version: 1.6.0
2017-08-17T07:13:59.389Z - normal: Simulator: 	gl.vendor: Intel Inc.
2017-08-17T07:13:59.391Z - normal: Simulator: 	gl.supports_PVRTC: false
2017-08-17T07:13:59.394Z - normal: Simulator: 	gl.renderer: Intel Iris OpenGL Engine
2017-08-17T07:13:59.398Z - normal: Simulator: 	cocos2d.x.compiled_with_profiler: false
2017-08-17T07:13:59.400Z - normal: Simulator: 	gl.max_texture_size: 16384
2017-08-17T07:13:59.401Z - normal: Simulator: 	gl.supports_ETC1: false
2017-08-17T07:13:59.401Z - normal: Simulator: 	gl.supports_BGRA8888: false
2017-08-17T07:13:59.402Z - normal: Simulator: 	cocos2d.x.build_type: DEBUG
2017-08-17T07:13:59.402Z - normal: Simulator: 	gl.max_texture_units: 16
2017-08-17T07:13:59.402Z - normal: Simulator: 	gl.supports_OES_packed_depth_stencil: false
2017-08-17T07:13:59.402Z - normal: Simulator: 	gl.supports_discard_framebuffer: false
2017-08-17T07:13:59.403Z - normal: Simulator: 	gl.supports_NPOT: true
2017-08-17T07:13:59.403Z - normal: Simulator: 	gl.version: 2.1 INTEL-10.25.13
2017-08-17T07:13:59.403Z - normal: Simulator: 	cocos2d.x.compiled_with_gl_state_cache: true
2017-08-17T07:13:59.404Z - normal: Simulator: 	gl.supports_OES_depth24: false
2017-08-17T07:13:59.404Z - normal: Simulator: }
2017-08-17T07:13:59.404Z - normal: Simulator: 
2017-08-17T07:13:59.405Z - normal: Simulator: 
2017-08-17T07:13:59.405Z - normal: Simulator: cocos2d: warning, Director::setProjection() failed because size is 0
2017-08-17T07:13:59.412Z - normal: Simulator: Project Config:
2017-08-17T07:13:59.413Z - normal: Simulator:     project dir: /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/simulator/mac/Simulator.app/Contents/Resources/
2017-08-17T07:13:59.414Z - normal: Simulator:     writable path: $(PROJDIR)/
2017-08-17T07:13:59.415Z - normal: Simulator:     script file: $(PROJDIR)/main.js
2017-08-17T07:13:59.415Z - normal: Simulator:     frame size: 960 x 640
2017-08-17T07:13:59.416Z - normal: Simulator:     frame scale: 1.00
2017-08-17T07:13:59.417Z - normal: Simulator:     show console: NO
2017-08-17T07:13:59.418Z - normal: Simulator:     write debug log: NO ()
2017-08-17T07:13:59.418Z - normal: Simulator:     listen: 
2017-08-17T07:13:59.418Z - normal: Simulator:     debugger: none
2017-08-17T07:13:59.419Z - normal: Simulator:     add searching path:
2017-08-17T07:13:59.419Z - normal: Simulator: 
2017-08-17T07:13:59.420Z - normal: Simulator: 
2017-08-17T07:13:59.420Z - normal: Simulator: 
2017-08-17T07:13:59.420Z - normal: Simulator: ------------------------------------------------
2017-08-17T07:13:59.421Z - normal: Simulator: LOAD Js FILE: main.js
2017-08-17T07:13:59.421Z - normal: Simulator: ------------------------------------------------
2017-08-17T07:13:59.422Z - normal: Simulator: Cocos2d-x-lite v1.6.0
2017-08-17T07:13:59.902Z - normal: Simulator: iShow!
2017-08-17T07:14:00.129Z - normal: Simulator: ScriptingCore:: compileScript fail:buffer

我在模拟器/Applications/CocosCreator.app/Contents/Resources/cocos2d-x/simulator/mac/Simulator.app/Contents/Resources/main.js 里写了几个log

            console.log("onStart0");
            for (var path in modules) {

                var module = modules[path];
                                console.log("module",path,module);
                if (!module.module) {
                    module.func();
                }
            }
            console.log("onStart1");

输出

       onStart0
       module preview-scripts/__node_modules/asn1.js/lib/asn1.js [object Object]
       ScriptingCore:: compileScript fail:buffer
1赞

应该是因为直接 require 了 node modules 里面的依赖 buffer,找不到,你需要单独把 node module 打包出一个 js 文件,导入为插件

恩,问题解决了,我们require了一个md5库,改成源码导入就可以了。

此贴可以删除了