question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MemoryFileSystemError

See original GitHub issue
const SERVER = require("./www/server.bundle").default;
const express = require("express");
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
// const webpackHotServerMiddleware = require('webpack-hot-server-middleware');
const app = express();
const PORT = 3000;
const compiler = webpack(require('./build/webpack/prod.js'));
app.use(webpackDevMiddleware(compiler));
app.use(webpackHotMiddleware(compiler.compilers.find(compiler => compiler.name === 'client')));
// app.use(webpackHotServerMiddleware(compiler));
app.use(SERVER);
app.listen(PORT, console.log.bind("listening at http://localhost:" + PORT));

If I uncomment the lines (webpackHotServerMiddleware itself) above, my build errors

/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:112
			throw new MemoryFileSystemError(errors.code.EISDIR, _path);
         ^
Error
    at MemoryFileSystem.readFileSync (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:112:10)
    at MultiCompiler.multiCompiler.plugin.multiStats (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack-hot-server-middleware/src/index.js:119:33)
    at MultiCompiler.applyPlugins (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/tapable/lib/Tapable.js:25:14)
    at MultiCompiler.<anonymous> (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/MultiCompiler.js:76:10)
    at Compiler.applyPlugins (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/tapable/lib/Tapable.js:25:14)
    at Watching._done (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/Compiler.js:93:17)
    at /home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/Compiler.js:76:18
    at Compiler.emitRecords (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/Compiler.js:350:37)
    at /home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/Compiler.js:59:19
    at /home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/Compiler.js:343:11
    at next (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/tapable/lib/Tapable.js:118:11)
    at Compiler.<anonymous> (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:115:3)
    at Compiler.applyPluginsAsyncSeries1 (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/tapable/lib/Tapable.js:122:13)
    at Compiler.afterEmit (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/Compiler.js:340:8)
    at Compiler.<anonymous> (/home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/lib/Compiler.js:335:14)
    at /home/cescoferraro/code/go/src/github.com/cescoferraro/spotify/node_modules/webpack/node_modules/async/dist/async.js:356:16

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cescoferrarocommented, Jan 24, 2017

@richardsarrott That’s what I am doing. I just created the express chunk to see if could bundle everything with webpack to get cool syntax, but you are right. It’s not worth it.

0reactions
cescoferrarocommented, Jan 26, 2017

I ended up doing

const env = process.env.NODE_ENV || 'development';
entry: {
	server: [env === "production" ? "./src/server" : "./src/middleware"]
},

So with NODE_ENV=production I endup with a single server bundle with all the dependencies. Its especially good for docker, because instead of doing

FROM  mhart/alpine-node:6
RUN npm init -y
RUN npm i express morgan
WORKDIR /srv/spotify
ADD src/hot.js /srv/spotify/hot.js
ADD www/ /srv/spotify/www
CMD ["node","hot.js"]

I can

FROM  mhart/alpine-node:base-6
WORKDIR /srv/spotify
ADD www/ /srv/spotify/www
CMD ["node","www/server.bundle.js"]

For this the client/middleware/server.tsx files live inside the src dir while I keep a hot.js file on my root. Not having hmr logic inside the app source code makes sense for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are System Error Memory Dump Files in Windows 11/10?
System Error Memory Dump Files are basically error logs that are created whenever your computer crashes. They can hold small amount of ...
Read more >
How to Fix This Error: Memory Card Shows Invalid File System
You will need to repair/format raw memory card or recover your data back. Solutions: Memory Card Shows Invalid File System (RAW). 1. Format...
Read more >
Memory fs error on windows ==> throw new ... - GitHub
I'm trying to use this package on windows but i keep getting error : throw new MemoryFileSystemError(errors.code.ENOENT, _path).
Read more >
How to Fix a File System Error in Windows 10 (Full Guide)
How to fix a file system error on Windows 10 · 1. Check for Windows Updates · 4. Run CHKDSK · 5. Use...
Read more >
Fix: The Volume Does Not Contain a Recognized File System ...
This page shows you how to fix The volume does not contain a recognized file system in Windows 10/8/7 with EaseUS RAW drive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found