title: Error: Cannot find module 'webpack/lib/node/NodeOutputFileSystem' React App after upgrading Webpack 4 to 5
body: <p>Got this error after upgrading webpack from 4 to 5.</p>
  <p>I saw this error on many other questions, but nothing seems to solve my issue.</p>
  <p>This are my dependencies:</p>
  <pre><code>  &quot;dependencies&quot;: {
      &quot;@babel/polyfill&quot;: &quot;7.4.3&quot;,
      &quot;@bootstrap-styled/color&quot;: &quot;^1.0.9&quot;,
      &quot;@bootstrap-styled/css-mixins&quot;: &quot;^2.0.7&quot;,
      &quot;@bootstrap-styled/css-utils&quot;: &quot;^1.3.2&quot;,
      &quot;@bootstrap-styled/navigation-bar&quot;: &quot;^1.9.5&quot;,
      &quot;@bootstrap-styled/provider&quot;: &quot;^1.5.1&quot;,
      &quot;@bootstrap-styled/v4&quot;: &quot;^3.1.5&quot;,
      &quot;bootstrap-styled&quot;: &quot;^2.5.2&quot;,
      &quot;chalk&quot;: &quot;2.4.2&quot;,
      &quot;compression&quot;: &quot;1.7.4&quot;,
      &quot;connected-react-router&quot;: &quot;6.4.0&quot;,
      &quot;cross-env&quot;: &quot;5.2.0&quot;,
      &quot;draft-js&quot;: &quot;^0.11.7&quot;,
      &quot;express&quot;: &quot;4.16.4&quot;,
      &quot;fontfaceobserver&quot;: &quot;2.1.0&quot;,
      &quot;history&quot;: &quot;4.9.0&quot;,
      &quot;hoist-non-react-statics&quot;: &quot;3.3.0&quot;,
      &quot;immer&quot;: &quot;9.0.6&quot;,
      &quot;intl&quot;: &quot;1.2.5&quot;,
      &quot;invariant&quot;: &quot;2.2.4&quot;,
      &quot;ip&quot;: &quot;1.1.5&quot;,
      &quot;js-sha512&quot;: &quot;^0.8.0&quot;,
      &quot;kefir&quot;: &quot;^3.8.6&quot;,
      &quot;lodash&quot;: &quot;^4.17.21&quot;,
      &quot;minimist&quot;: &quot;^1.2.5&quot;,
      &quot;prop-types&quot;: &quot;15.7.2&quot;,
      &quot;react&quot;: &quot;17.0.2&quot;,
      &quot;react-dom&quot;: &quot;17.0.2&quot;,
      &quot;react-helmet&quot;: &quot;6.0.0-beta&quot;,
      &quot;react-intl&quot;: &quot;2.8.0&quot;,
      &quot;react-redux&quot;: &quot;7.0.2&quot;,
      &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
      &quot;redux&quot;: &quot;4.0.1&quot;,
      &quot;redux-saga&quot;: &quot;1.0.2&quot;,
      &quot;reselect&quot;: &quot;4.0.0&quot;,
      &quot;sanitize.css&quot;: &quot;8.0.0&quot;,
      &quot;shortid&quot;: &quot;^2.2.15&quot;,
      &quot;showdown&quot;: &quot;^1.9.1&quot;,
      &quot;styled-components&quot;: &quot;4.2.0&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@babel/cli&quot;: &quot;7.4.3&quot;,
      &quot;@babel/core&quot;: &quot;7.4.3&quot;,
      &quot;@babel/plugin-proposal-class-properties&quot;: &quot;7.4.0&quot;,
      &quot;@babel/plugin-syntax-dynamic-import&quot;: &quot;7.2.0&quot;,
      &quot;@babel/plugin-transform-modules-commonjs&quot;: &quot;7.4.3&quot;,
      &quot;@babel/plugin-transform-react-constant-elements&quot;: &quot;7.2.0&quot;,
      &quot;@babel/plugin-transform-react-inline-elements&quot;: &quot;7.2.0&quot;,
      &quot;@babel/preset-env&quot;: &quot;7.4.3&quot;,
      &quot;@babel/preset-react&quot;: &quot;7.0.0&quot;,
      &quot;@babel/register&quot;: &quot;7.4.0&quot;,
      &quot;add-asset-html-webpack-plugin&quot;: &quot;3.1.3&quot;,
      &quot;babel-core&quot;: &quot;7.0.0-bridge.0&quot;,
      &quot;babel-eslint&quot;: &quot;10.0.1&quot;,
      &quot;babel-loader&quot;: &quot;8.0.5&quot;,
      &quot;babel-plugin-dynamic-import-node&quot;: &quot;2.2.0&quot;,
      &quot;babel-plugin-lodash&quot;: &quot;3.3.4&quot;,
      &quot;babel-plugin-react-intl&quot;: &quot;3.0.1&quot;,
      &quot;babel-plugin-styled-components&quot;: &quot;1.10.0&quot;,
      &quot;babel-plugin-transform-react-remove-prop-types&quot;: &quot;0.4.24&quot;,
      &quot;circular-dependency-plugin&quot;: &quot;5.0.2&quot;,
      &quot;compare-versions&quot;: &quot;3.4.0&quot;,
      &quot;compression-webpack-plugin&quot;: &quot;6.0.2&quot;,
      &quot;coveralls&quot;: &quot;3.0.3&quot;,
      &quot;css-loader&quot;: &quot;2.1.1&quot;,
      &quot;eslint&quot;: &quot;5.16.0&quot;,
      &quot;eslint-config-airbnb&quot;: &quot;17.1.0&quot;,
      &quot;eslint-config-airbnb-base&quot;: &quot;13.1.0&quot;,
      &quot;eslint-config-prettier&quot;: &quot;4.1.0&quot;,
      &quot;eslint-import-resolver-webpack&quot;: &quot;0.11.1&quot;,
      &quot;eslint-plugin-import&quot;: &quot;2.17.2&quot;,
      &quot;eslint-plugin-jsx-a11y&quot;: &quot;6.2.1&quot;,
      &quot;eslint-plugin-prettier&quot;: &quot;3.0.1&quot;,
      &quot;eslint-plugin-react&quot;: &quot;7.12.4&quot;,
      &quot;eslint-plugin-react-hooks&quot;: &quot;1.6.0&quot;,
      &quot;eslint-plugin-redux-saga&quot;: &quot;1.0.0&quot;,
      &quot;file-loader&quot;: &quot;3.0.1&quot;,
      &quot;html-loader&quot;: &quot;0.5.5&quot;,
      &quot;html-webpack-plugin&quot;: &quot;^5.4.0&quot;,
      &quot;image-webpack-loader&quot;: &quot;4.6.0&quot;,
      &quot;imports-loader&quot;: &quot;0.8.0&quot;,
      &quot;jest-cli&quot;: &quot;26.4.2&quot;,
      &quot;jest-dom&quot;: &quot;3.1.3&quot;,
      &quot;jest-styled-components&quot;: &quot;^6.3.3&quot;,
      &quot;lint-staged&quot;: &quot;^11.0.0&quot;,
      &quot;ngrok&quot;: &quot;3.1.1&quot;,
      &quot;node-plop&quot;: &quot;^0.26.2&quot;,
      &quot;null-loader&quot;: &quot;0.1.1&quot;,
      &quot;plop&quot;: &quot;^2.7.4&quot;,
      &quot;pre-commit&quot;: &quot;1.2.2&quot;,
      &quot;prettier&quot;: &quot;1.17.0&quot;,
      &quot;react-app-polyfill&quot;: &quot;0.2.2&quot;,
      &quot;react-test-renderer&quot;: &quot;16.8.6&quot;,
      &quot;react-testing-library&quot;: &quot;6.1.2&quot;,
      &quot;rimraf&quot;: &quot;2.6.3&quot;,
      &quot;shelljs&quot;: &quot;0.8.3&quot;,
      &quot;style-loader&quot;: &quot;0.23.1&quot;,
      &quot;stylelint&quot;: &quot;13.13.1&quot;,
      &quot;stylelint-config-recommended&quot;: &quot;2.2.0&quot;,
      &quot;stylelint-config-styled-components&quot;: &quot;0.1.1&quot;,
      &quot;stylelint-processor-styled-components&quot;: &quot;1.6.0&quot;,
      &quot;svg-url-loader&quot;: &quot;2.3.2&quot;,
      &quot;terser-webpack-plugin&quot;: &quot;4.2.2&quot;,
      &quot;url-loader&quot;: &quot;1.1.2&quot;,
      &quot;webpack&quot;: &quot;^5.60.0&quot;,
      &quot;webpack-cli&quot;: &quot;^4.9.1&quot;,
      &quot;webpack-dev-middleware&quot;: &quot;^5.2.1&quot;,
      &quot;webpack-dev-server&quot;: &quot;^4.3.1&quot;,
      &quot;webpack-hot-middleware&quot;: &quot;^2.25.1&quot;,
      &quot;webpack-pwa-manifest&quot;: &quot;^4.3.0&quot;,
      &quot;whatwg-fetch&quot;: &quot;3.0.0&quot;
    }
  }
  
  </code></pre>
  <p>And this is my webpack config:</p>
  <pre><code>/**
   * COMMON WEBPACK CONFIGURATION
   */
  
  const path = require('path');
  const webpack = require('webpack');
  
  module.exports = options =&gt; ({
    mode: options.mode,
    entry: options.entry,
    output: Object.assign(
      {
        // Compile into js/build.js
        path: path.resolve(process.cwd(), 'build'),
        publicPath: '/',
      },
      options.output,
    ), // Merge with env dependent settings
    optimization: options.optimization,
    module: {
      rules: [
        {
          test: /\.jsx?$/, // Transform all .js and .jsx files required somewhere with Babel
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
            options: options.babelQuery,
          },
        },
        {
          // Preprocess our own .css files
          // This is the place to add your own loaders (e.g. sass/less etc.)
          // for a list of loaders, see https://webpack.js.org/loaders/#styling
          test: /\.css$/,
          exclude: /node_modules/,
          use: ['style-loader', 'css-loader'],
        },
        {
          // Preprocess 3rd party .css files located in node_modules
          test: /\.css$/,
          include: /node_modules/,
          use: ['style-loader', 'css-loader'],
        },
        {
          test: /\.(eot|otf|ttf|woff|woff2)$/,
          use: 'file-loader',
        },
        {
          test: /\.svg$/,
          use: [
            {
              loader: 'svg-url-loader',
              options: {
                // Inline files smaller than 10 kB
                limit: 10 * 1024,
                noquotes: true,
              },
            },
          ],
        },
        {
          test: /\.(jpg|png|gif)$/,
          use: [
            {
              loader: 'url-loader',
              options: {
                // Inline files smaller than 10 kB
                limit: 10 * 1024,
              },
            },
            {
              loader: 'image-webpack-loader',
              options: {
                mozjpeg: {
                  enabled: false,
                  // NOTE: mozjpeg is disabled as it causes errors in some Linux environments
                  // Try enabling it in your environment by switching the config to:
                  // enabled: true,
                  // progressive: true,
                },
                gifsicle: {
                  interlaced: false,
                },
                optipng: {
                  optimizationLevel: 7,
                },
                pngquant: {
                  quality: '65-90',
                  speed: 4,
                },
              },
            },
          ],
        },
        {
          test: /\.html$/,
          use: 'html-loader',
        },
        {
          test: /\.(mp4|webm)$/,
          use: {
            loader: 'url-loader',
            options: {
              limit: 10000,
            },
          },
        },
      ],
    },
    plugins: options.plugins.concat([
      // Always expose NODE_ENV to webpack, in order to use `process.env.NODE_ENV`
      // inside your code for any environment checks; Terser will automatically
      // drop any unreachable code.
      new webpack.EnvironmentPlugin({
        NODE_ENV: 'development',
      }),
    ]),
    resolve: {
      modules: ['node_modules', 'app'],
      extensions: ['.js', '.jsx', '.react.js'],
      mainFields: ['browser', 'jsnext:main', 'main'],
    },
    devtool: options.devtool,
    target: 'web', // Make web variables accessible to webpack, e.g. window
    performance: options.performance || {},
  });
  </code></pre>
  <p>Not sure what is missing. I checked on github (<a href="https://github.com/webpack/webpack/tree/main/lib/node" rel="nofollow noreferrer">https://github.com/webpack/webpack/tree/main/lib/node</a>) And this <code>NodeOutputFileSystem</code> does not seems to exist.</p>
  <p>Any ideas?</p>