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

请求帮助,传统项目直接在浏览器里引用这个为什么报错 #2724

Open
zhaoyan519 opened this issue Mar 19, 2024 · 5 comments

Comments

@zhaoyan519
Copy link

引用了这个 https://cdn.jsdelivr.net/npm/exceljs@4.4.0/dist/exceljs.js , 报错如下,请求帮助

TypeError: fs.createWriteStream is not a function
at XLSX.writeFile (excel.min.js:16156:59)
at wn.showCacheInfo (manager.js:100:22)
at He (vue.min.2.6.12.js:6:11384)
at a.n (vue.min.2.6.12.js:6:13168)
at He (vue.min.2.6.12.js:6:11384)
at e.$emit (vue.min.2.6.12.js:6:34373)
at a.handleClick (index.js:1:125669)
at He (vue.min.2.6.12.js:6:11384)
at HTMLButtonElement.n (vue.min.2.6.12.js:6:13168)

@LSL1618
Copy link

LSL1618 commented Apr 12, 2024

用这个 https://cdn.jsdelivr.net/npm/exceljs@4.4.0/dist/exceljs.min.js
我一般都是下载到项目内部来使用
<script type="text/javascript" src="../static/plugins/exceljs/4.4.0/exceljs.min.js"></script>

@famousprince
Copy link

@LSL1618
Copy link

LSL1618 commented Apr 15, 2024

@LSL1618 可以试试南科大的公共 CDN: https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/exceljs/4.4.0/exceljs.min.js

或者 Zstatic 的也不错: https://s4.zstatic.net/ajax/libs/exceljs/4.4.0/exceljs.min.js

确实不错,可我的是内网项目,无法访问外网,所以静态资源必须放在项目内部。

@AlwaysNoobCoder
Copy link

浏览器里面哪里来的fs,那是nodejs里才有的吧

@LSL1618
Copy link

LSL1618 commented Apr 26, 2024

浏览器里面哪里来的fs,那是nodejs里才有的吧

fs确实是nodejs才有的,题主引用错了文件,exceljs.js是nodejs端用的,exceljs.min.js才是浏览器端用的。

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

4 participants