weex-plugins / Chart-for-Apache-Weex

Chart for Apache Weex is a third party plugin, and is not developed nor maintained by Apache Weex.
Apache License 2.0
35 stars 11 forks source link

Demo无法运行 #2

Open zfha opened 7 years ago

zfha commented 7 years ago

Demo无法运行 在执行到第5步骤的时候,报错 我把plugins/weex-chart/examples 拷贝到src下,然后run ios,错误如下

ERROR in ./~/.0.3.4@weex-loader/lib/script.js!./~/.6.3.2@babel-loader/lib?presets[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&presets=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&plugins[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&plugins=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&comments=false!./~/.0.3.4@weex-loader/lib/extract.js?index=0&type=scripts!./src/demo.we
Module not found: Error: Cannot resolve module 'weex-chart' in /Users/zhoufan/Documents/project/g2Demo/src
 @ ./~/.0.3.4@weex-loader/lib/script.js!./~/.6.3.2@babel-loader/lib?presets[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&presets=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&plugins[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&plugins=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&comments=false!./~/.0.3.4@weex-loader/lib/extract.js?index=0&type=scripts!./src/demo.we 3:9-30

ERROR in ./~/.0.3.4@weex-loader/lib/script.js!./~/.6.3.2@babel-loader/lib?presets[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&presets=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&plugins[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&plugins=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&comments=false!./~/.0.3.4@weex-loader/lib/extract.js?index=0&type=scripts!./src/demo2.we
Module not found: Error: Cannot resolve module 'weex-chart' in /Users/zhoufan/Documents/project/g2Demo/src
 @ ./~/.0.3.4@weex-loader/lib/script.js!./~/.6.3.2@babel-loader/lib?presets[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&presets=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-preset-es2015&plugins[]=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&plugins=/Users/zhoufan/Documents/project/g2Demo/~/.0.3.4@weex-loader/~/babel-plugin-transform-runtime&comments=false!./~/.0.3.4@weex-loader/lib/extract.js?index=0&type=scripts!./src/demo2.we 3:9-30

而且对weex-chart/examples/package.json中

{
  "name": "@ali/weex-chart-demo",
  "version": "0.0.1",
  "platform": [
    "ios",
    "android"
  ],
  "description": "",
  "keywords": [
    "weex",
    "plugin"
  ],
  "publishConfig": {
    "registry": "http://registry.npm.alibaba-inc.com"
  },
  "license": "Apache 2.0",
  "dependencies": {
    "weex-chart": "^0.0.2",
    "g2-mobile": "^2.1.8",
    "weex-components": "^0.2.0"
  }
}

为何还是tnpm的registry,npm install weex-chart 会出现404问题? 请问什么时候能在外部使用weex-chart

exolution commented 7 years ago

sorry 这个package我忘了改掉了 但是这个example里的package.json对于用户来说是完全无用的东西(这个是我之前把demo发成一个tnpm的库了 现在已经废弃) module not found "weex-chart" 这个错误 跟这个无关 请问你 weexpack plugin add weex-chart 执行成功了么 因为这个命令会把weex-chart的库代码放到你项目目录下的node_modules里 这样编译的时候就可以打进去 所请首先确认weexpack plugin add weex-chart 执行成功 然后看下node_modules里是否有weex-chart这个目录

samyzh commented 7 years ago

@exolution 我这边官方步骤运行起来了,点击列表图标,报错。我这边是不是那里没有配置好,也还是这个插件不完善? 报错如下:

03-21 10:17:11.947 12039-12054/com.alibaba.weex D/weex: callJS >>>> instanceId:2function:callJS tasks:[{"data":"2","type":2},{"data":"[{\"args\":[4,{},true],\"method\":\"callback\"}]","type":3}]
03-21 10:17:11.948 12039-12054/com.alibaba.weex D/weex: [WXBridgeManager] callNative >>>> instanceId:2, tasks:[{"module":"dom","method":"updateFinish","args":[]}], callback:-1
03-21 10:17:11.950 12039-12039/com.alibaba.weex E/art: No implementation found for java.lang.String com.taobao.gcanvas.GCanvasJNI.getAllParameter(java.lang.String) (tried Java_com_taobao_gcanvas_GCanvasJNI_getAllParameter and Java_com_taobao_gcanvas_GCanvasJNI_getAllParameter__Ljava_lang_String_2)
03-21 10:17:11.950 12039-12039/com.alibaba.weex E/SafeRunnable: SafeRunnable run throw expection:java.lang.reflect.InvocationTargetException
03-21 10:17:11.950 12039-12039/com.alibaba.weex D/AndroidRuntime: Shutting down VM
03-21 10:17:11.951 12039-12039/com.alibaba.weex E/AndroidRuntime: FATAL EXCEPTION: main
                                                                  Process: com.alibaba.weex, PID: 12039
                                                                  java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
                                                                      at com.taobao.weex.bridge.NativeInvokeHelper$1.run(NativeInvokeHelper.java:236)
                                                                      at com.taobao.weex.common.WXThread$SafeRunnable.run(WXThread.java:234)
                                                                      at android.os.Handler.handleCallback(Handler.java:739)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                   Caused by: java.lang.reflect.InvocationTargetException
                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                      at com.taobao.weex.bridge.MethodInvoker.invoke(MethodInvoker.java:232)
                                                                      at com.taobao.weex.bridge.NativeInvokeHelper$1.run(NativeInvokeHelper.java:234)
                                                                      at com.taobao.weex.common.WXThread$SafeRunnable.run(WXThread.java:234) 
                                                                      at android.os.Handler.handleCallback(Handler.java:739) 
                                                                      at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                      at android.os.Looper.loop(Looper.java:148) 
                                                                      at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                      at java.lang.reflect.Method.invoke(Native Method) 
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                   Caused by: java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String com.taobao.gcanvas.GCanvasJNI.getAllParameter(java.lang.String) (tried Java_com_taobao_gcanvas_GCanvasJNI_getAllParameter and Java_com_taobao_gcanvas_GCanvasJNI_getAllParameter__Ljava_lang_String_2)
                                                                      at com.taobao.gcanvas.GCanvasJNI.getAllParameter(Native Method)
                                                                      at com.taobao.gcanvas.GCanvas.executeDelegate(GCanvas.java:680)
                                                                      at com.taobao.gcanvas.GCanvas.executeForWeex(GCanvas.java:347)
                                                                      at com.taobao.weex.ui.module.GcanvasModule.execGcanvasCMD(GcanvasModule.java:858)
                                                                      at com.taobao.weex.ui.module.GcanvasModule.enable(GcanvasModule.java:376)
                                                                      at java.lang.reflect.Method.invoke(Native Method) 
                                                                      at com.taobao.weex.bridge.MethodInvoker.invoke(MethodInvoker.java:232) 
                                                                      at com.taobao.weex.bridge.NativeInvokeHelper$1.run(NativeInvokeHelper.java:234) 
                                                                      at com.taobao.weex.common.WXThread$SafeRunnable.run(WXThread.java:234) 
                                                                      at android.os.Handler.handleCallback(Handler.java:739) 
                                                                      at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                      at android.os.Looper.loop(Looper.java:148) 
                                                                      at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                      at java.lang.reflect.Method.invoke(Native Method) 
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
03-21 10:17:11.970 12039-12054/com.alibaba.weex D/weex: callJS >>>> instanceId:2function:callJS tasks:[{"data":"2","type":2},{"data":"[{\"args\":[4,{},true],\"method\":\"callback\"}]","type":3}]
03-21 10:17:11.983 12039-12054/com.alibaba.weex D/weex: [WXBridgeManager] callNative >>>> instanceId:2, tasks:[{"module":"dom","method":"updateFinish","args":[]}], callback:-1
03-21 10:17:11.990 12039-12045/com.alibaba.weex W/art: Suspending all threads took: 5.129ms
ellisez commented 6 years ago

weexpack plugin add weex-chart执行等了很久, 最后发现 repositories{ maven { url "http://mvnrepo.alibaba-inc.com/mvn/repository" } maven { url "http://mvnrepo.alibaba-inc.com/mvn/snapshots" } } 这两个仓库是无效的超时的。

后来全部注释掉,仓库以及 //apply plugin: 'com.taobao.android.weex.plugin.gradle'

以及 //compile 'com.taobao.android:weexplugin-loader:1.1-SNAPSHOT' //compile 'com.taobao.android:weexplugin-processor:1.1-SNAPSHOT' //compile 'com.taobao.android:weexplugin-annotation:1.1-SNAPSHOT' 感觉这些都是些片段版本库嘛

经过一系列注释之后,终于 weexpack plugin add weex-chart 成功了, 但是。。。。 node_modules下没有weex-chart目录

求解

ellisez commented 6 years ago

补充一下, 只有plugins下有weex-chart目录

ellisez commented 6 years ago

经测试,weexpack plugin add weex-chart执行之后,node_modules下确实生成了weex-chart目录 但遗憾的是,weexpack run android会执行一次npm install,那么package.json中没有配置,自然会被node_modules删除

忘快一些修正,只要package.json写入即可