gpt4 book ai didi

webpack - 如何安装 webpack-cli?

转载 作者:行者123 更新时间:2023-12-04 15:29:57 41 4
gpt4 key购买 nike

我已经安装了 webpack 4.5.0。

当我尝试运行 webpack 时,它提示它需要 webpack-cli。

如果我运行 npm install webpack-cli我收到以下错误:

The CLI moved into a separate package: webpack-cli
Would you like to install webpack-cli? (That will run npm install -D webpack-cli) (yes/NO)yes
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN webpack-cli@2.0.14 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.

+ webpack-cli@2.0.14
updated 1 package in 14.175s
{ Error: Cannot find module 'webpack-cli'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at runCommand.then.result (/usr/local/lib/node_modules/webpack/bin/webpack.js:62:14)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7) code: 'MODULE_NOT_FOUND' }

有人看过这个并以某种方式修复它吗?

最佳答案

发生这种情况是因为虽然 webpack-cli可能是全局安装的,它没有安装在您当前的项目中,并且不知何故该项目无法使用全局安装的版本。

我通过运行 npm install webpack-cli 解决了这个问题在相关的项目目录中。

关于webpack - 如何安装 webpack-cli?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49881278/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com