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.

fs missing from webpack

See original GitHub issue

getting this error

 ERROR  Failed to compile with 1 errors                                                                21:03:36

This module was not found:

* fs in ./~/request/lib/har.js

To install it, you can run: npm install --save fs

from googling around, it seems some people had success with adding

node: {
  fs: "empty"
}

to their webpack config

I tried adding that in next.config.js without success. could it be syntax, or is that not the correct file ?

similar issue seen here https://github.com/josephsavona/valuable/issues/9

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

26reactions
RobinDvorakcommented, Mar 31, 2018

This can be solved with adding config.node = {fs: "empty"}; to your config.

10reactions
bnmghjtyu0commented, May 28, 2019
// next.config.js

module.exports = withImages(
  withCSS(
    withSass({
      exportPathMap: function() {
        return {
          '/': { page: '/' }
        }
      },
      webpack(config) {
        config.node = { fs: 'empty' }
        return config
      },
    })
  )
)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Node cannot find module "fs" when using webpack
I'm using node.js and webpack to create a bundle. From what I've read, node.js should contain fs module for managing files.
Read more >
Configuration - webpack
dev is an online tool for creating custom webpack configurations. It allows you to select various features that will be combined and added...
Read more >
can't resolve 'fs' webpack 5 | The AI Search Engine You Control
This often make problems with bundlers such as Webpack because the bundlers try to resolve all modules in the source code, including require('fs')...
Read more >
Missing module error | JavaScript Chart Forums - SciChart
Home Questions Missing module error ... at webpackMissingModule (buildDataSeries.js:15:94) ... Ignore fs should be removed or updated in webpack.config
Read more >
Next.js + Webpack - Fix for ModuleNotFoundError: Module not ...
If you're building a Next.js app that uses a Node.js module that only exists on the server-side such as the file system (fs)...
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