redux-persist-node-storage icon indicating copy to clipboard operation
redux-persist-node-storage copied to clipboard

fs.statSync is not a function

Open rafaelpessoacompasso opened this issue 4 years ago • 2 comments

I installed redux-persist-node-storage and use the example, but a have problem: TypeError: fs.statSync is not a function

LocalStorage.prototype._init = function() { var _MetaKey, _decodedKey, _keys, e, error, error1, i, index, k, len, stat; try { stat = fs.statSync(this._location); //the problem if ((stat != null) && !stat.isDirectory()) { throw new Error("A file exists at the location '" + this._location + "' when trying to create/open localStorage"); } ...

rafaelpessoacompasso avatar Dec 28 '20 20:12 rafaelpessoacompasso

fs is not a dependency of redux-persist-node-storage. Is it possible there's an issue with how you're importing fs?

pellejacobs avatar Jan 05 '21 10:01 pellejacobs

I'm getting the same error - it appears to be an issue with the LocalStorage import at https://github.com/pellejacobs/redux-persist-node-storage/blob/36c0ae5ff805779d094927f67adf5befef1367ab/src/index.ts#L1.

I can see the errored code block at https://github.com/lmaccherone/node-localstorage/blob/3f58430a8847172ada6d097fb162420fd143d08e/LocalStorage.coffee#L97 at a later version.

kevin-beatdapp avatar Jul 08 '21 18:07 kevin-beatdapp