React: failed to compile // webpack problem - reactjs

My project can't be compiled anymore. It came suddenly , I didn't get why.
It seems to be related to webpack. Maybe I need to downgrade webpack the version before 5 but I don't see how to do it in React.
I managed to reduce errors from 90 to 7 with adding resolve:fallback but I don't know what to do with others.
So, now I have these errors:
Failed to compile.
Module not found: Error: Can't resolve 'child_process' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'
WARNING in ./node_modules/jest-worker/build/WorkerPool.js 25:4-29
Module not found: Error: Can't resolve 'worker_threads' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build'
WARNING in ./node_modules/jest-worker/build/base/BaseWorkerPool.js 122:19-46
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/jest-worker/build/index.js 71:19-38
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/jest-worker/build/workers/processChild.js 83:15-28
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/jest-worker/build/workers/processChild.js 99:15-28
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/loader-runner/lib/loadLoader.js 20:19-39
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/terser-webpack-plugin/dist/minify.js 43:118-125
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
WARNING in ./node_modules/terser-webpack-plugin/dist/utils.js 519:18-51
Module not found: Error: Can't resolve 'uglify-js/package.json' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'
WARNING in ./node_modules/terser-webpack-plugin/dist/utils.js 596:18-51
Module not found: Error: Can't resolve '#swc/core/package.json' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'
WARNING in ./node_modules/terser-webpack-plugin/dist/utils.js 678:18-49
Module not found: Error: Can't resolve 'esbuild/package.json' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'
WARNING in ./node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib/[url]' file: Error: ENOENT: no such file or directory, open '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib/[url]'
WARNING in ./node_modules/webpack/lib/debug/ProfilingPlugin.js 29:14-34
Module not found: Error: Can't resolve 'inspector' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib/debug'
WARNING in ./node_modules/webpack/lib/serialization/ObjectMiddleware.js 679:18-34
Critical dependency: the request of a dependency is an expression
ERROR in ./node_modules/jest-worker/build/workers/ChildProcessWorker.js 9:15-39
Module not found: Error: Can't resolve 'child_process' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'
ERROR in ./node_modules/jest-worker/build/workers/NodeThreadsWorker.js 29:15-40
Module not found: Error: Can't resolve 'worker_threads' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'
ERROR in ./node_modules/jest-worker/build/workers/messageParent.js 23:8-33
Module not found: Error: Can't resolve 'worker_threads' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'
ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 481:6-26
Module not found: Error: Can't resolve 'uglify-js' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'
ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 560:14-34
Module not found: Error: Can't resolve '#swc/core' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'
ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 639:18-36
Module not found: Error: Can't resolve 'esbuild' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'
ERROR in ./node_modules/webpack/lib/FileSystemInfo.js 11:19-36
Module not found: Error: Can't resolve 'module' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib'
Did you mean './module'?
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, /Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/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.
webpack compiled with 7 errors and 13 warnings

Related

error:Module not found: Error: Can't resolve './components/product/create.component' in 'C:\xampp\htdocs\React\crud-react\src' ERROR in

I am creating CRUD operation and I got an error
Module not found: Error: Can't resolve './components/product/create.component' in 'C:\xampp\htdocs\React\crud-react\src'
ERROR in ./src/App.js 15:0-66
anyone can tell me how can I recognize the line which has an error and 'create.component' how can run individually?
I tried to update the npm package

How to render 'MJML-REACT' in NGINX web application

I have created a small Email notification react project(GINX web application), which is now basically supporting HTML emails and Plain emails. Keeping an eye on the future, I want to include MJML also in my project but after installing npm mjml-react library and when I try to import any elements from that library, it is throwing an error which says Module not found: Can't resolve 'fs'
I am happy to get inputs from you guys on how to Render mjml-react library in my NGINX web application
Module not found: Error: Can't resolve 'fs' in 'C:\Users\malliar\Dap\Dap-ui\dap-management-ui\acceleratorUI\node_modules\clean-css\lib\reader'
Module not found: Error: Can't resolve 'fs' in 'C:\Users\malliar\Dap\Dap-ui\dap-management-ui\acceleratorUI\node_modules\clean-css\lib\reader'
Module not found: Error: Can't resolve 'fs' in
'C:\Users\malliar\Dap\Dap-ui\dap-management-ui\acceleratorUI\node_modules\uglify-js\tools'
Module not found: Error: Can't resolve 'mjml' in
'C:\Users\malliar\Dap\Dap-ui\dap-management-ui\acceleratorUI\node_modules\mjml-react\dist\es\src'

export { default } from 'react-native-web/dist/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter';

Im doing a React Native project, and whenever i run 'npm start' and choose 'w' for web in the Metro Bundler, i'll get this error:
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
Above this error, it tells me this:
C:/Users/silas/node_modules/expo-modules-core/build/index.js
Module not found: Error: Can't resolve 'react-native-web/dist/exports/DeviceEventEmitter' in 'C:\Users\silas\node_modules\expo-modules-core\build'
C:/Users/silas/node_modules/expo-modules-core/build/EventEmitter.js
Module not found: Error: Can't resolve 'react-native-web/dist/exports/NativeEventEmitter' in 'C:\Users\silas\node_modules\expo-modules-core\build'
C:/Users/silas/node_modules/expo-modules-core/build/Platform.js
Module not found: Error: Can't resolve 'react-native-web/dist/exports/Platform' in 'C:\Users\silas\node_modules\expo-modules-core\build'
C:/Users/silas/node_modules/expo-modules-core/build/EventEmitter.js
Module not found: Error: Can't resolve 'react-native-web/dist/exports/Platform' in 'C:\Users\silas\node_modules\expo-modules-core\build'
../../../../../../node_modules/expo-modules-core/build/SyntheticPlatformEmitter.web.js:5
Module not found: Can't resolve 'react-native-web/dist/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter'
3 | * registered in the API layer with `NativeEventEmitter`.
4 | */
> 5 | export { default } from 'react-native-web/dist/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter';
Does anyone knows how to fix this error? I've tried to run 'npm install'.

Modules not found

My project failed to compile saying ./src/index.js
Module not found: Can't resolve './registerServiceWorker' in 'C:\Users\Jaybee\Desktop\Projects\webzone\src'
Can you show index.js file?
And also check out this thread, it may be the same problem:
Module not found: Can't resolve './registerServiceWorker

Error: Cannot resolve module 'module' in path/.../rewire/lib

I am using rewire prior to require method in my React/Flux app, to load components. But after installation I got this error:
ERROR in ./~/rewire/lib/rewire.js
Module not found: Error: Cannot resolve module 'module' in /Users/path/node_modules/rewire/lib
# ./~/rewire/lib/rewire.js 1:13-30
ERROR in ./~/rewire/lib/rewire.js
Module not found: Error: Cannot resolve module 'fs' in /Users/path/node_modules/rewire/lib
# ./~/rewire/lib/rewire.js 2:9-22
ERROR in ./~/rewire/lib/moduleEnv.js
Module not found: Error: Cannot resolve module 'module' in /Users/path/node_modules/rewire/lib
# ./~/rewire/lib/moduleEnv.js 3:13-30
ERROR in ./~/rewire/lib/moduleEnv.js
Module not found: Error: Cannot resolve module 'fs' in /Users/path/node_modules/rewire/lib
# ./~/rewire/lib/moduleEnv.js 4:9-22
While googling I found similar issue, but no desirable solution. Does anyone know what is the issue or conflict about and how to resolve it?
This is a webpack issue.
Since you're trying to use rewire, I'll assume you plan to run your tests through NodeJS and not a browser. Otherwise, check out rewire-webpack.
Rewire expects a NodeJS environment, but by default webpack targets a browser environment, and as such doesn't know about the standard NodeJS modules that rewire might depend on.
You need to set the target property of your webpack config to "node" in order to let webpack know it should consider standard NodeJS modules as externals.

Resources