本文介绍了custom_element_apigen:向Dart导入纸张数据时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我按照步骤操作,请遵守 https://github.com/dart-lang / custom-element-apigen :I following the steps, accord to https://github.com/dart-lang/custom-element-apigen: 安装了节点/ npm(v3.5.3) 安装了bower(v1.7.2) 安装了水印(v1.21.4) .bowerrc 使用以下内容创建 node/npm (v3.5.3) installedbower (v1.7.2) installedhydrolysis (v1.21.4) installed.bowerrc created with following content {directory:lib / src } install --save paper-datatable ( https://github.com/ David-Mulder / paper-datatable )执行 apigen.yaml 内容 files_to_generate: - paper-datatable\paper-datatable。 html custom_element_apigen library add on pubspec.yaml 依赖项: custom_element_apigen:^ 0.2.1 + 1 执行命令pub run custom_element_apigen:update apigen.yaml b 此命令发生错误 第一个错误:在Windows上没有工作。有关 https://github.com/dart-lang/custom-element的详情-apigen / issues / 43 。First error: On Windows did not work. Details on https://github.com/dart-lang/custom-element-apigen/issues/43.作为解决方法,我创建 process_elements.bat code> process_elements.sh )具有以下内容:As a workaround I create process_elements.bat (instead process_elements.sh) with following content: 节点packages\custom_element_apigen\src\\ \\ js \analyze.js%1 我编辑 generate_dart_api.dart 已将通话 .bat 改为 .sh :'D:/Users/Administrador/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/custom_element_apigen-0.2.1+1/lib/src/js/process_elements.bat', [inputPath]);然后,我得到了一个工作环境!Then, I got a workarround! 第二个错误,我没有解决!现在,当命令 c:\ dart-sdk \bin \pub run custom_element_apigen:update apigen.yaml 被执行:D:\Users\Administrador\WebstormProjects\Facilis>c:\dart-sdk\bin\pub run custom_element_apigen:update apigen.yaml←[32m1 of 1: lib\src\paper-datatable\paper-datatable.html←[0mUnhandled exception:Failed to parse element files!exit code: 0stderr:stdout:D:\Users\Administrador\WebstormProjects\Facilis>node packages\custom_element_apigen\src\js\analyze.js lib\src\paper-datatable\paper-datatable.html{"imports":["lib/src/polymer/polymer.html","lib/src/paper-datatable/paper-datatable-column.html","lib/src/paper-datatable/paper-datatable-edit-dialog.html","lib/src/paper-datatable/datatable-icons.html","lib/src/paper-checkbox/paper-checkbox.html","lib/src/paper-tooltip/paper-tooltip.html"],"elements":{"PaperDatatable":{"name":"paper-datatable","properties":{"data":{"hasGetter":true,"hasSetter":true,"name":"data","type":"Array","description":"\nArray of objects containing the data to be shown in the table.\n\n"},"multiSelection":{"hasGetter":true,"hasSetter":true,"name":"multiSelection","type":"Boolean","description":"\nWhether to allow selection of more than one row.\n\n"},"progress":{"hasGetter":true,"hasSetter":true,"name":"progress","type":"Boolean","description":"\nWhether to show the progress bar. As the progress bar is often not used in standalone\n`<paper-datatable>'s the `<paper-progress>` element isn't included by default and needs to be\nmanually imported.\n\n"},"resizeBehavior":{"hasGetter":true,"hasSetter":true,"name":"resizeBehavior","type":"String","description":"\nOverflow, fixed or 'dynamic-columns'\n\n"},"selectable":{"hasGetter":true,"hasSetter":true,"name":"selectable","type":"Boolean","description":"\nWhether to show checkboxes on the left to allow row selection.\n\n"},"selectedItem":{"hasGetter":true,"hasSetter":true,"name":"selectedItem","type":"Object","description":"\nIf `multi-selection` isoff then this contains the selected row.\n\n"},"selectedItems":{"hasGetter":true,"hasSetter":true,"name":"selectedItems","type":"Array","description":"\nIf `multi-selection` is on then this contains an array of the selected rows.\n\n"},"selectedKey":{"hasGetter":true,"hasSetter":true,"name":"selectedKey","type":"Object","description":"\nIf `multi-selection` is off then this contains the key of the selected row.\n\n"},"selectedKeys":{"hasGetter":true,"hasSetter":true,"name":"selectedKeys","type":"Array","description":"\nIf `multi-selection` then this contains an array of selected row keys.\n\n"},"listeners":{"hasGetter":true,"hasSetter":true,"name":"listeners","type":"Object","description":""},"observers":{"hasGetter":true,"hasSetter":true,"name":"observers","type":"Array","description":""}},"methods":{"customRowStyle":{"name":"customRowStyle","type":null,"description":"\nMethod that can be overwritten to apply a custom style to specific rows.\n\nIMPORTANT: This is a property, not a method you should call directly.\n\t\t\t\t","isVoid":true,"args":[{"name":"rowItem","description":""}]},"deselect":{"name":"deselect","type":null,"description":"\nDeselect the specified item. Ignore the `notify` parameter.\n\n","isVoid":true,"args":[{"name":"item","description":""},{"name":"notify","description":""}]},"deselectAll":{"name":"deselectAll","type":null,"description":"\nDeselect all currently selected items. Ignore the `notify` parameter.\n\t\t\t\t ","isVoid":true,"args":[{"name":"notify","description":""}]},"filter":{"name":"filter","type":null,"description":"\nThe filter attributecan be used to specify a filter which will be applied to the `data`.\nNote thatselections should fully ignore filtering, and a filter only affects which data is\nvisible.\n\nThe function takes three arguments: `item`, `key` and `items` per the JS filter function.\n\nFor a demo please see [here](demo/filter.html).\n\nIMPORTANT: This is a property, not a method you should call directly.\n\n","isVoid":true,"args":[]},"reload":{"name":"reload","type":null,"description":"\nIf you have been changing data on the `data` property outside of the official Polymerfunctions\ncalling this function *may* get you the updates you want.\n\t\t\t\t ","isVoid":true,"args":[]},"reset":{"name":"reset","type":null,"description":"\nHardcore reset of the entire element. Sets `data` to `[]` and resets all cells.\n\t\t\t\t ","isVoid":true,"args":[]},"select":{"name":"select","type":null,"description":"\nSelect the specified item. Ignore the `notify` parameter.\n\n","isVoid":true,"args":[{"name":"item","description":""},{"name":"notify","description":""}]},"sort":{"name":"sort","type":null,"description":"\nSort the specified column, where `column` is a reference to the actual `<paper-datatable-column>`\nelement.\n\t\t\t\t ","isVoid":true,"args":[{"name":"column","description":""}]},"toggleAll":{"name":"toggleAll","type":null,"description":"\nTriggered by clicking the top left checkmark. If all are checked it will deselect all checked items.\nIf some or none are checked it will select all items\n\t\t\t\t ","isVoid":true,"args":[]},"ready":{"name":"ready","type":null,"description":"","isVoid":true,"args":[]}},"description":"\n# Paper Datatable\n\nA [material design implementationof a data table](https://www.google.com/design/spec/components/data-tables.html).\n\n","behaviors":["Polymer.IronResizableBehavior"]}},"behaviors":{},"path":"lib\\src\\paper-datatable\\paper-datatable.html"}#0 _parseError (package:custom_element_apigen/generate_dart_api.dart:202:3)#1 _parseFile.<_parseFile_async_body> (package:custom_element_apigen/generate_dart_api.dart:160:5)#2 _RootZone.runUnary (dart:async/zone.dart:1149)#3 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)#4 _Future._propagateToListeners (dart:async/future_impl.dart:585)#5 _Future._completeWithValue (dart:async/future_impl.dart:376)#6 Future.wait.<anonymous closure> (dart:async/future.dart:299)#7 _RootZone.runUnary (dart:async/zone.dart:1149)#8 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)#9 _Future._propagateToListeners (dart:async/future_impl.dart:585)#10 _Future._completeWithValue (dart:async/future_impl.dart:376)#11 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:430)#12 _microtaskLoop (dart:async/schedule_microtask.dart:43)#13 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)#14 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)#15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)我做错了什么?或者这是一个错误? Am I doing something wrong? or Is this a bug? 谢谢!推荐答案这是一个错误,未经测试的窗口,因为它主要刚刚被聚合物dart团队使用。This is a bug, the package is untested on windows as it has primarily just been used by the polymer dart team.看起来一般喜欢的修复只需要加载 It looks in general like the the fix just needs to be loading the .bat file as you already did and then also adjusting the paths to use the correct directory separator.请参阅 https://github.com/dart-lang/custom-element-apigen/issues/43 。See https://github.com/dart-lang/custom-element-apigen/issues/43. 这篇关于custom_element_apigen:向Dart导入纸张数据时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 18:29