解决Webpack安装中peerDependencies问题:Webpack 5.88.2与Webpack CLI 5.1.4的兼容性
解决Webpack安装中peerDependencies问题:Webpack 5.88.2与Webpack CLI 5.1.4的兼容性
根据你的输出日志,你已经成功通过npm install webpack -g安装了Webpack 5.88.2版本。bashC:\Users\86139>npm install webpack -gD:\node.js\node_global\webpack -> D:\node.js\node_global\node_modules\webpack\bin\webpack.js+ webpack@5.88.2added 78 packages from 129 contributors in 35.967s
你试图使用npm show webpack@5.88.2 peerDependencies命令获取Webpack 5.88.2的peerDependencies信息,但命令没有输出结果。这可能是由于命令执行时出现了一些问题,你可以尝试重新运行该命令或者查看官方文档确认命令的正确性。
随后,你使用npm install webpack-cli@5.1.4 -g命令全局安装了Webpack CLI 5.1.4版本。然而,你遇到了一些警告信息,提示你需要安装Webpack 5.x.x作为peer dependency。bashC:\Users\86139>npm install webpack-cli@5.1.4 -gD:\node.js\node_global\webpack-cli -> D:\node.js\node_global\node_modules\webpack-cli\bin\cli.jsnpm WARN webpack-cli@5.1.4 requires a peer of webpack@5.x.x but none is installed. You must install peer dependencies yourself.npm WARN @webpack-cli/serve@2.0.5 requires a peer of webpack@5.x.x but none is installed. You must install peer dependencies yourself.npm WARN @webpack-cli/info@2.0.2 requires a peer of webpack@5.x.x but none is installed. You must install peer dependencies yourself.npm WARN @webpack-cli/configtest@2.1.1 requires a peer of webpack@5.x.x but none is installed. You must install peer dependencies yourself.
- webpack-cli@5.1.4added 39 packages from 33 contributors in 15.783s
这些警告信息表明Webpack CLI 5.1.4依赖于Webpack 5.x.x版本,你需要手动安装Webpack 5.x.x来满足Webpack CLI的要求。
你可以使用以下命令安装Webpack 5.x.x:bashnpm install webpack@5.x.x -g
安装完成后,你可以再次运行npm install webpack-cli@5.1.4 -g命令,确保Webpack CLI和Webpack版本匹配,并消除警告信息。
希望这些信息能够帮助你解决Webpack安装过程中遇到的peerDependencies问题!
原文地址: https://www.cveoy.top/t/topic/E6g 著作权归作者所有。请勿转载和采集!