protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
814 stars 416 forks source link

ERROR in ./node_modules/xlsx-style/dist/cpexcel.js #137

Closed Xonshiz closed 4 years ago

Xonshiz commented 4 years ago

I am working with angular 6 and I recently tried to install this via npm install xlsx-style --save and I also tried npm install xlsx-style.

I tried importing it and I got the error "module not found" and then in the command window, I see this error :

ERROR in ./node_modules/xlsx-style/dist/cpexcel.js
Module not found: Error: Can't resolve './cptable' in 'C:\myProject\node_modules\xlsx-style\dist'
ERROR in ./node_modules/xlsx-style/xlsx.js
Module not found: Error: Can't resolve 'fs' in 'C:\myProject\node_modules\xlsx-style'
ERROR in ./node_modules/xlsx-style/ods.js
Module not found: Error: Can't resolve 'fs' in 'C:\myProject\node_modules\xlsx-style'

My project is running in the "strict mode" and I can't remove that. I stumbled upon this old thread of SheetJS... #324.

I'm not really sure the issue is and why it's popping up. Can you look into this?

MrCodeFront commented 4 years ago

me too

Xonshiz commented 4 years ago

Update on this Issue : I contacted the dev team for js-xlsx and asked them about this issue. This was their reply :

We no longer actively maintain js-xlsx. It was originally intended as a temporary branch of SheetJS/js-xlsx, but that project went into a different direction. We ported most style features to msexcel-builder as we only need to generate XLSX and not read or write other formats.

A line of code like "var cpt = require('./cpt' + 'able');" is so twisted there must have been a reason the original author wrote it like that.

There are 50,000+ unit tests associated with the code, both browser and server side, so am hesitant to make a change without running them. But this fork runs completely only on node 0.10 and broke after Node 4.0.

As you can see there's lots of demand for style support in the community edition of js-xlsx, and I believe many people would pay for support as the SheetJS author is reportedly unresponsive to price requests, and no one develops for Excel as a hobby.

You might create a new branch of the SheetJS/js-xlsx community edition, port styles over to that, and offer paid support to commercial clients.

For a workaround, you can refer to this answer on Stackoverflow. It works : StackOverflow Answer

Xonshiz commented 4 years ago

I'll close this issue, as seems like this will never be fixed.