如何安装Grunt

我用Homebrew来安装Node.js,然后使用npm install来安装Grunt及其依赖项,但安装完成后,我无法运行Grunt:

 zsh: correct 'grunt' to 'grn' ÆnyaeÅ? n zsh: command not found: grunt 

什么是安装Grunt的正确方法,所以我不会得到这个错误?

要在命令行上使用Grunt,您必须安装命令行界面:

 npm install -g grunt-cli 

-g标志用于全局安装模块,这也将为Grunt创build一个PATHvariables。

 npm install -g grunt-cli => This will put the grunt command in your system path