I have a simple react application and I try to load
when I run my build:client script:
"build:client": "webpack --config config/webpack.client.js --watch",
I get the following error in my react application:
ERROR in ./src/client/app/app.tsx
Module not found: Error: Can't resolve 'style-loader' in '/Users/nobody1/Developement/info-db'
@ ./src/client/app/app.tsx 5:0-30
@ ./src/client/index.tsx
I tried to install style-loader
npm i style-loader
but i got this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ok@1.0.0
npm ERR! Found: webpack@4.46.0
npm ERR! node_modules/webpack
npm ERR! webpack@"^4.46.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^5.0.0" from style-loader@3.3.1
npm ERR! node_modules/style-loader
npm ERR! style-loader@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/nobody1/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nobody1/.npm/_logs/2022-09-17T19_49_47_465Z-debug.log
So i updated my package-json
"webpack": "^5.00.0"
and ran npm I
I get the error
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: ok@1.0.0
npm WARN Found: webpack@4.46.0
npm WARN node_modules/webpack
npm WARN webpack@"^5.00.0" from the root project
npm WARN 7 more (babel-loader, copy-webpack-plugin, css-loader, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"4.x.x" from webpack-cli@3.3.12
npm WARN node_modules/webpack-cli
npm WARN dev webpack-cli@"^3.3.12" from the root project
but the installation continues and the packet is installed
I execute my build:client script again and then the terminal outputs something that looks like js object.
[...]
watch: { '$ref': '#/definitions/Watch' },
watchOptions: { '$ref': '#/definitions/WatchOptions' }
}
},
headerName: 'Webpack',
baseDataPath: 'configuration',
postFormatter: [Function: postFormatter]
}
The terminal process "/bin/zsh '-c', 'npm run build:client'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
I don't know how to resolve this "error message"