![](/img/trans.png)
[英]objects-to-csv TypeError: fs.existsSync is not a function
[英]Unhandled Rejection (TypeError): fs.existsSync is not a function
我在reactjs
使用epub-gen 。
未處理的拒絕(TypeError):fs.existsSync 不是函數
我測試了import * as fs from "fs"
而不是var fs = require("fs")
。
epub-gen/lib/index.js在這里。
// Generated by CoffeeScript 2.3.2
(function() {
var fs = require("fs");
...
EPub = class EPub {
..
if (!fs.existsSync(this.options.tempDir)) {
fs.mkdirSync(this.options.tempDir);
}
..
我假設您想使用 Web 應用程序生成文件。 在 React Web 應用程序中使用 FileSystem 是不可能的,因為瀏覽器無法訪問文件系統。
為此,您應該在node
創建后端並在您的節點應用程序中使用這段代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.