ngx-cache icon indicating copy to clipboard operation
ngx-cache copied to clipboard

FS Storage errors due to existing .cache directory

Open whakamolenz opened this issue 6 years ago • 3 comments
trafficstars

I'm submitting a ... (check one with "x")

[X] Regression (a behavior that used to work and stopped working in a new release)
[] Bug report  <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request

Current behavior When using SSR rendering and the FS Storage module, when the cache directory already exists (i.e. all loads but the very first one) then an error is given.

Error: EEXIST: file already exists, mkdir 'D:\home\site\wwwroot.cache' at fs.mkdirSync (fs.js:885:18) at new FsStorageService (D:\home\site\wwwroot\server.js:160265:65) at _createClass (D:\home\site\wwwroot\server.js:25360:20) at createProviderInstance (D:\home\site\wwwroot\server.js:25332:26) at resolveNgModuleDep (D:\home\site\wwwroot\server.js:25296:21) at NgModuleRef.get (D:\home\site\wwwroot\server.js:26004:16) at new FsCacheService (D:\home\site\wwwroot\server.js:160665:35) at _createClass (D:\home\site\wwwroot\server.js:25362:20) at _createProviderInstance (D:\home\site\wwwroot\server.js:25332:26) at resolveNgModuleDep (D:\home\site\wwwroot\server.js:25296:21)

Expected/desired behavior Looks like the package isn't checking for existing directory before calling mkdirSync. Expect existing directory to be used and no error.

Minimal reproduction of the problem with instructions

whakamolenz avatar Mar 06 '19 21:03 whakamolenz

Any news about this bug ?

squelix avatar Mar 21 '19 16:03 squelix

There was a work around posted in https://github.com/ng-seed/universal/issues/631. Looks like it would make a good permanent fix as well.

paullryan avatar May 08 '19 01:05 paullryan

@frankiej45nz @squelix @paullryan sorry for the delay, had busy times. feel free to fire a PR and i'll approve.

fulls1z3 avatar Nov 22 '19 00:11 fulls1z3