npm依赖:与webpack的恶性循环

npm依赖:与webpack的恶性循环,npm,Npm,正在尝试在本地设置现有项目 当我运行npm install时,它告诉我缺少webpack@^4的对等依赖项 $ npm install npm WARN css-loader@1.0.0 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself. npm WARN file-loader@1.1.11 requires a peer of webpack

正在尝试在本地设置现有项目

当我运行
npm install
时,它告诉我缺少
webpack@^4
的对等依赖项

$ npm install
npm WARN css-loader@1.0.0 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN file-loader@1.1.11 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN friendly-errors-webpack-plugin@2.0.0-beta.2 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
[...]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
但是,安装它会引发更多的依赖性问题:

$ npm install --save webpack@4
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN assets-webpack-plugin@7.0.0 requires a peer of webpack@>=5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN imports-loader@2.0.0 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@11.0.1 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN terser-webpack-plugin@5.1.1 requires a peer of webpack@^5.1.0 but none is installed. You must install peer dependencies yourself.
[...]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
解决这些问题的正确方法是什么