【问题标题】:TypeError: Cannot set property length of [object Object] which has only a getter while converting xls-to-jsonTypeError:在转换 xls-to-json 时无法设置只有 getter 的 [object Object] 的属性长度
【发布时间】:2016-01-23 11:33:30
【问题描述】:

下面是我正在使用的代码,节点版本 4.2.5,xls-to-json@0.3.2 xls-to-json

  function convXLStoJSON1(inputfile,outputfile, sheetName)
     {

        node_xj = require("C:/Protractor_Scripts/node_modules/xls-to-json");

        node_xj({
                        input: inputfile,  // input xls 
                        output: outputfile, // output json 
                        //sheet:sheetName,
                        },

     function(err, result) {
                        if(err) {
                        console.error(err);
                        } else {
                        //console.log(result);
                        }
        });
        browser.sleep(500);
    };

下面是完整的错误

Selenium 独立服务器在 htt:56/w/hu 开始

[launcher] 错误:TypeError:无法设置 [object 的属性长度 Object] 在 sbcs_d 只有一个吸气剂 (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\dist\cpexcel.js:904:20)

在 Object.decode (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\dist\cpexel.js:187:40) 在_gc2 (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:19:23) 在 Buffer.ReadShift [as read_shift] (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:18:13) 在 parse_XLUnicodeStringNoCch (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:179:36) 在 parse_XLUnicodeString (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:178:9) 在 Object.parse_WriteAccess [as f] (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:059:17) 啜饮 (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:5411:11) 在 parse_workbook (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:559:15) 在 parse_xlscfb (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\xls.js:594:27)

[启动器] 进程退出,错误代码为 100

【问题讨论】:

    标签: json node.js npm protractor converter


    【解决方案1】:

    问题在于 xls-to-json 包的 xls 文件夹中的 Package.json。我尝试使用其他 Package.json 文件对其进行更新,但没有成功。

    我安装了 xlsx-to-json 而不是 xls-to-json ,效果很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-29
      • 1970-01-01
      • 2022-07-27
      • 2020-09-26
      • 2021-05-31
      • 2019-02-24
      • 2020-09-16
      相关资源
      最近更新 更多