Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve 'fs' in xlsx-style #16

Open
vixper opened this issue Jul 2, 2018 · 13 comments
Open

Can't resolve 'fs' in xlsx-style #16

vixper opened this issue Jul 2, 2018 · 13 comments

Comments

@vixper
Copy link

vixper commented Jul 2, 2018

Hi,
I'm using angular 6 and I can export json data with XLSX using ngx-excel-export.

When I try to style the exported excel document through xlsx-style, I get building errors:

`WARNING in ./node_modules/xlsx-style/xlsx.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Web\node_modules\xlsx-style'

ERROR in ./node_modules/xlsx-style/xlsx.js
Module not found: Error: Can't resolve 'fs' in 'D:\Web\node_modules\xlsx-style'
ERROR in ./node_modules/xlsx-style/ods.js
Module not found: Error: Can't resolve 'fs' in 'D:\Web\node_modules\xlsx-style'`

How can I solve that?

Thanks
PS: I'm not using node or webpack, it's a simple angular application.

@kunj1234
Copy link

same issue

@vixper
Copy link
Author

vixper commented Aug 24, 2018

any solution?

@ShubhamJainSJ
Copy link

Facing same issue in Angular 6 project. Any solution for this?

@aminghe
Copy link

aminghe commented Sep 30, 2018

same issue.
Any solution for this?
@vixper @ShubhamJainSJ

@ShivaInnovation
Copy link

Same issue, any solution???

@aminghe
Copy link

aminghe commented Oct 10, 2018

@ShivaInnovation

Hi, I've solved my problem with another library.
I used exceljs.

https://github.com/guyonroche/exceljs#styles

Your code sample is this source
https://www.ngdevelop.tech/export-to-excel-in-angular-6/

good luck

@abhinavkumar985
Copy link

Facing the same issue with Angular 6, any solution ?

@sw-tracker
Copy link

Any solutions found? (aside from switching to a different module)

@ChloeQiuFeelGood
Copy link

same issue with Angular 7, any solution ?

@AngelLover2017
Copy link

@vixper

`WARNING in ./node_modules/xlsx-style/xlsx.js
Module not found: Error: Can't resolve 'crypto' in 'D:\Web\node_modules\xlsx-style'

to solve this issue , i modified source code of 'xlsx-style/dist/cpexcel.js' from var cpt = require('./cpt' + 'able'); to var cpt = cptable

ERROR in ./node_modules/xlsx-style/xlsx.js
Module not found: Error: Can't resolve 'fs' in 'D:\Web\node_modules\xlsx-style'
ERROR in ./node_modules/xlsx-style/ods.js
Module not found: Error: Can't resolve 'fs' in 'D:\Web\node_modules\xlsx-style'`

for these two issues , i solved by adding node attribute to 'webpack.config.js',like this

node: {
  fs: "empty"
}

One passible reason here is the webpack treat 'fs' as package module but not node module

@leventkalay
Copy link

in my project webpack.config.js doesnt exist. how can i fix it ?

@Turing2048
Copy link

在我的项目中 webpack.config.js 不存在。我该如何解决?

这里说的是自己项目的webpack.confog.js,而不是xlsx-style的,你可以自己在项目根目录新建一个webpack.config.js,让你在打包的时候自动正确识别fs。

@sebastiananea
Copy link

in my project webpack.config.js doesnt exist. how can i fix it ?

Did you find any solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests