1

After I updated my angular project from 12 to 13 version I got a lot of module errors when I ran ng serve --o. How I can fix it?

 BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }

./node_modules/cacache/lib/util/tmp.js:6:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'D:\StudenBook\node_modules\cacache\lib\util'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

./node_modules/cacache/lib/verify.js:3:13-28 - Error: Module not found: Error: Can't resolve 'util' in 'D:\StudenBook\node_modules\cacache\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }

./node_modules/cacache/lib/verify.js:8:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'D:\StudenBook\node_modules\cacache\lib'

./node_modules/cacache/lib/verify.js:12:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'D:\StudenBook\node_modules\cacache\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

./node_modules/cacache/rm.js:3:13-28 - Error: Module not found: Error: Can't resolve 'util' in 'D:\StudenBook\node_modules\cacache'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }

./node_modules/cacache/rm.js:7:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'D:\StudenBook\node_modules\cacache'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

./node_modules/chownr/chownr.js:2:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'D:\StudenBook\node_modules\chownr'

./node_modules/chownr/chownr.js:3:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'D:\StudenBook\node_modules\chownr'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

./node_modules/detect-libc/lib/detect-libc.js:3:15-37 - Error: Module not found: Error: Can't resolve 'os' in 'D:\StudenBook\node_modules\detect-libc\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
        - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "os": false }

./node_modules/detect-libc/lib/detect-libc.js:4:16-50 - Error: Module not found: Error: Can't resolve 'child_process' in 'D:\StudenBook\node_modules\detect-libc\lib'

./node_modules/detect-libc/lib/detect-libc.js:5:18-43 - Error: Module not found: Error: Can't resolve 'fs' in 'D:\StudenBook\node_modules\detect-libc\lib'

./node_modules/fs-minipass/index.js:4:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'D:\StudenBook\node_modules\fs-minipass'

./node_modules/fs.realpath/index.js:8:9-22 - Error: Module not found: Error: Can't resolve 'fs' in 'D:\StudenBook\node_modules\fs.realpath'

./node_modules/fs.realpath/old.js:22:17-32 - Error: Module not found: Error: Can't resolve 'path' in 'D:\StudenBook\node_modules\fs.realpath'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

./node_modules/fs.realpath/old.js:24:9-22 - Error: Module not found: Error: Can't resolve 'fs' in 'D:\StudenBook\node_modules\fs.realpath'

./node_modules/gauge/lib/error.js:2:11-26 - Error: Module not found: Error: Can't resolve 'util' in 'D:\StudenBook\node_modules\gauge\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }

./node_modules/glob/common.js:13:11-26 - Error: Module not found: Error: Can't resolve 'path' in 'D:\StudenBook\node_modules\glob'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

./node_modules/glob/glob.js:43:9-22 - Error: Module not found: Error: Can't resolve 'fs' in 'D:\StudenBook\node_modules\glob'

./node_modules/glob/glob.js:49:11-26 - Error: Module not found: Error: Can't resolve 'path' in 'D:\StudenBook\node_modules\glob'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

./node_modules/glob/glob.js:50:13-30 - Error: Module not found: Error: Can't resolve 'assert' in 'D:\StudenBook\node_modules\glob'

And more others module errors... Please help me

Philipp Meissner
  • 5,273
  • 5
  • 34
  • 59
P.Gorod
  • 21
  • 1
  • 5
  • Read the error messages, then search for the error message on your favorite search engine, discover that this is something others have seen before, then do something to correct the problem. Basics of troubleshooting, really. https://stackoverflow.com/questions/64402821/module-not-found-error-cant-resolve-util-in-webpack – R. Richards Dec 19 '21 at 16:32
  • So, I found out my problem; All of troubleshooting was cuz of bcrypt module, I deleted it. I installed it previous. Don't know why its caused so many troubles – P.Gorod Dec 19 '21 at 19:01

1 Answers1

1

you may need to use npm install to install all your lost modules

for example for your util module error, use this command to reinstall it again:

npm i util

AliRhz
  • 39
  • 4