5

i have the next error when i try to include react-share in my app, all compile fine and if i go to another routes where no is loading this library works fine, but when i include it crash.

TypeError: util.inherits is not a function

i am using webpack dev server with webpack 2. i am mocked the next modules

note: i tried to mock utils so because util is not defined in not node env.

node: {
    fs: "empty",
    child_process: "empty",
  },
Linda Paiste
  • 38,446
  • 6
  • 64
  • 102
  • 1
    I have the same basic problem. The only other references I could find were [this other stackoverflow question](http://stackoverflow.com/questions/42908420/webpack-dev-server-2-uncaught-typeerror-util-inherits-is-not-a-function) and [this github issue](https://github.com/webpack/webpack/issues/1019) which contains some workarounds, though none worked for me. – Michael Plotke May 02 '17 at 14:00
  • 1
    I also encountered this problem. Does anyone have a solution for it? – Shlomo Dec 08 '19 at 07:36

1 Answers1

3

I had the same problem and eventually found that the problem was that I had a folder name 'util' and somehow the webpack mixed it with the function util.inhirits. i changed the folder's name and now it is OK.

Shlomo
  • 357
  • 3
  • 11