Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve 'util' #90

Open
2 tasks done
navono opened this issue Apr 15, 2019 · 2 comments
Open
2 tasks done

Module not found: Can't resolve 'util' #90

navono opened this issue Apr 15, 2019 · 2 comments

Comments

@navono
Copy link

navono commented Apr 15, 2019

Description

I create a app with create-react-app with --typescript, and add some lib to it. But when I execute start script, a compilation error has occurred:

Failed to compile.

./node_modules/browserify-zlib/lib/index.js
Module not found: Can't resolve 'util' in 'E:\sourcecode\frontend\AppDev-web\node_modules\browserify-zlib\lib'

I'm not explicit import browserify-zlib, so I search it in project, in yarn.lock file, I found this:

node-libs-browser@^2.0.0:
  version "2.2.0"
  resolved "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.0.tgz#c72f60d9d46de08a940dedbb25f3ffa2f9bbaa77"
  integrity sha512-5MQunG/oyOaBdttrL40dA7bUfPORLRWMUJLQtMg7nluxUvk5XwnLdL9twQHFAjRx/y7mIMkLKT9++qPbbk6BZA==
  dependencies:
    assert "^1.1.1"
    browserify-zlib "^0.2.0"
    buffer "^4.3.0"
    console-browserify "^1.1.0"
    constants-browserify "^1.0.0"
    crypto-browserify "^3.11.0"
    domain-browser "^1.1.1"
    events "^3.0.0"
    https-browserify "^1.0.0"
    os-browserify "^0.3.0"
    path-browserify "0.0.0"
    process "^0.11.10"
    punycode "^1.2.4"
    querystring-es3 "^0.2.0"
    readable-stream "^2.3.3"
    stream-browserify "^2.0.1"
    stream-http "^2.7.2"
    string_decoder "^1.0.0"
    timers-browserify "^2.0.4"
    tty-browserify "0.0.0"
    url "^0.11.0"
    util "^0.11.0"
    vm-browserify "0.0.4"
  • I tried add util package, still not work
  • I tried add util in webpack.config.js like this:
    node: {
      util: 'empty',
      module: 'empty',
      dgram: 'empty',
      dns: 'mock',
      fs: 'empty',
      net: 'empty',
      tls: 'empty',
      child_process: 'empty',
    },

still not work

Info

create-react-app: version: 2.1.8
webpack.config.js
package.json
tsconfig.json

Anybody know anything about this?

@sbasehart
Copy link

I'm also having this error with Angular, was there any solution?

@navono
Copy link
Author

navono commented Feb 24, 2020

it's too long after I commit this issue, and totally foget how to resolve this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants