I have been working on a project for a few days and my webpack suddenly stopped working today. I have 182 errors and 3 warnings everytime I compile everything. Here are all the errors I get:
WARNING in ../../../../node_modules/hash-stream-validation/index.js 5:8-30
Module not found: Error: Can't resolve 'fast-crc32c' in 'C:\Users\21210382\node_modules\hash-stream-validation'
@ ../../../../node_modules/@google-cloud/storage/build/src/file.js 24:29-62
@ ../../../../node_modules/@google-cloud/storage/build/src/index.js 20:13-30
@ ../../../../node_modules/firebase-admin/lib/storage/storage.js 55:22-62
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 149:26-63
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
WARNING in ../../../../node_modules/retry-request/index.js 74:21-39
Module not found: Error: Can't resolve 'request' in 'C:\Users\21210382\node_modules\retry-request'
@ ../../../../node_modules/google-gax/build/src/streamingCalls/streaming.js 22:21-45
@ ../../../../node_modules/google-gax/build/src/fallback.js 32:20-57 46:18-55
@ ../../../../node_modules/@google-cloud/firestore/build/src/index.js 428:95-121 1084:37-71 1373:15-43
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
WARNING in ../../../../node_modules/write-file-atomic/index.js 20:26-51
Module not found: Error: Can't resolve 'worker_threads' in 'C:\Users\21210382\node_modules\write-file-atomic'
@ ../../../../node_modules/configstore/index.js 7:24-52
@ ../../../../node_modules/@google-cloud/storage/build/src/gcs-resumable-upload.js 18:20-42
@ ../../../../node_modules/@google-cloud/storage/build/src/file.js 29:24-57
@ ../../../../node_modules/@google-cloud/storage/build/src/index.js 20:13-30
@ ../../../../node_modules/firebase-admin/lib/storage/storage.js 55:22-62
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 149:26-63
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
3 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/bulk-writer.js 3:15-32
Module not found: Error: Can't resolve 'assert' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
@ ../../../../node_modules/@google-cloud/firestore/build/src/index.js 21:22-46 46:20-44
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/document.js 19:15-32
Module not found: Error: Can't resolve 'assert' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
@ ../../../../node_modules/@google-cloud/firestore/build/src/index.js 25:19-40 48:17-38
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/index.js 18:17-34
Module not found: Error: Can't resolve 'stream' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/index.js 19:14-28
Module not found: Error: Can't resolve 'url' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
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: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/logger.js 18:13-28
Module not found: Error: Can't resolve 'util' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
Did you mean './util'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
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/@google-cloud/firestore/build/src/index.js 26:17-36 68:15-34
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/pool.js 18:15-32
Module not found: Error: Can't resolve 'assert' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
@ ../../../../node_modules/@google-cloud/firestore/build/src/index.js 28:15-32
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/rate-limiter.js 18:15-32
Module not found: Error: Can't resolve 'assert' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
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: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
@ ../../../../node_modules/@google-cloud/firestore/build/src/bulk-writer.js 5:23-48
@ ../../../../node_modules/@google-cloud/firestore/build/src/index.js 21:22-46 46:20-44
@ ../../../../node_modules/firebase-admin/lib/app/firebase-namespace.js 166:28-62
@ ../../../../node_modules/firebase-admin/lib/default-namespace.js 19:27-62
@ ../../../../node_modules/firebase-admin/lib/index.js 19:15-45
@ ./src/chat.js 11:0-41
ERROR in ../../../../node_modules/@google-cloud/firestore/build/src/recursive-delete.js 3:15-32
Module not found: Error: Can't resolve 'assert' in 'C:\Users\21210382\node_modules\@google-cloud\firestore\build\src'
The errors are repeated over and over again in the console. On the client side, we see this error: Uncaught error: Cannot find module 'fs'. But this error is in some file called lifecycle.js that I did not create.
I have tried reinstalling all the node modules and webpack. It didn't work. Here is my package.json:
{
"name": "monarchatfinal",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
},
"dependencies": {
"firebase": "^9.15.0"
}
}
and here is my webpack.config.js:
const path = require('path')
module.exports = {
mode: 'development',
entry: ['./src/index.js', './src/chat.js', './src/login.js', './src/signup.js'],
output: {
path: path.resolve(__dirname, 'dist/js'),
filename: '[name]bundle.js'
},
watch: true
}
Thanks for whoever tries to help.
CodePudding user response:
I have solved the problem. This is a message to everyone looking on the internet for a solution to their problem: Somehow and someway a little line of code (a useless one as a matter of fact) slipped into my code. This little line caused all the errors. So, look in all your files and you might just find the little problem.