为什么即使我已全局安装软件包,命令行也无法处理全局命令?

时间:2019-04-28 18:20:40

标签: npm webpack

我无法在任意目录中运行webpack --help,出现以下错误:

One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
 - webpack-cli (https://github.com/webpack/webpack-cli)
   The original webpack full-featured CLI.
We will use "npm" to install the CLI via "npm install -D".
Do you want to install 'webpack-cli' (yes/no): o
You need to install 'webpack-cli' to use webpack via CLI.
You can also install the CLI manually.

我显然同时使用了npmyarn。我想念什么?

1 个答案:

答案 0 :(得分:1)

您是否已通过npm全局安装了webpack-cli?

npm install --global webpack-cli

如果是这样,可以使用命令which webpack-cli进行验证吗?