memory-fs icon indicating copy to clipboard operation
memory-fs copied to clipboard

Memory fs error on windows ==> throw new MemoryFileSystemError(errors.code.ENOENT, _path)

Open mazeeblanke opened this issue 7 years ago • 4 comments

I'm trying to use this package on windows but i keep getting error : throw new MemoryFileSystemError(errors.code.ENOENT, _path)

In orer to debug the issue, i tried this and am still getting the same error

var MemoryFileSystem = require("memory-fs")
var fs = new MemoryFileSystem()

console.log(__dirname)

console.log(fs.readdirSync(__dirname))

mazeeblanke avatar Apr 22 '18 20:04 mazeeblanke

I believe I have the same problem. @mazeeblanke have you found a solution?

ilyaagarkov avatar Jun 04 '18 03:06 ilyaagarkov

@mazeeblanke Apparently its not an issue with the platform.__dirname points to your local working directory. In ur code ur trying to read it and it throws the error because its not yet created.

try

var MemoryFileSystem = require("memory-fs")
var fs = new MemoryFileSystem()
fs.mkdirpSync(__dirname)
console.log(__dirname)

console.log(fs.data)

The above piece will not throw an error as it creates a directory before its read

Viijay-Kr avatar Oct 26 '18 06:10 Viijay-Kr

@VijayKrish93 okay thanks i will try it

mazeeblanke avatar Oct 26 '18 15:10 mazeeblanke

still not work ... should I update the webpack? my webpack is ^2.7.0

/kuyu/html/activeCMS/dist/admin.html [0] [0] /kuyu/html/activeCMS/node_modules/memory-fs/lib/MemoryFileSystem.js:107 [0] throw new MemoryFileSystemError(errors.code.ENOENT, _path); [0] ^ [0] Error: no such file or directory [0] at MemoryFileSystem.readFileSync (/kuyu/html/activeCMS/node_modules/memory-fs/lib/MemoryFileSystem.js:107:10) [0] at Compiler.clientCompiler.plugin (/kuyu/html/activeCMS/build/setup-dev-server.js:33:26) [0] at Compiler.applyPlugins (/kuyu/html/activeCMS/node_modules/tapable/lib/Tapable.js:61:14) [0] at Watching._done (/kuyu/html/activeCMS/node_modules/webpack/lib/Compiler.js:98:16) [0] at onCompiled (/kuyu/html/activeCMS/node_modules/webpack/lib/Compiler.js:49:17)

CyanChoi avatar Jul 24 '19 07:07 CyanChoi