TypeError: Cannot set property length of [object Object] which has only a getter while converting xls-to-json

TypeError: Cannot set property length of [object Object] which has only a getter while converting xls-to-json

下面是我正在使用的代码,节点版本 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 standalone server started at htt:56/w/hu

[launcher] Error: TypeError: Cannot set property length of [object Object] whichhas only a getter at sbcs_d (C:\Protractor_Scripts\node_modules\xls-to-json\node_modules\xlsjs\dist\cpexcel.js:904:20)

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

[launcher] Process exited with error code 100

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

我安装了 xlsx-to-json 而不是 xls-to-json ,它工作正常。