Grunt-cli安装问题



我在本地和全局安装了grunt-cli,我可以在本地和全局路径中看到相同的内容。

要测试安装是否有效,当我试图运行

grunt -h

显示如下

    >> Local Npm module "grunt-cli" not found. Is it installed?
    Grunt: The JavaScript Task Runner (v0.4.5)
    Usage
     grunt [options] [task [task ...]]
    Options
     --help, -h  Display this help text.
     --base  Specify .......

当我运行grunt -v时,以下是它的部分输出

Registering "grunt-cli" local Npm module tasks.
Reading /Users/cominventor/myproject/node_modules/grunt-cli/package.json...OK
Parsing /Users/cominventor/myproject/node_modules/grunt-cli/package.json...OK
>> Local Npm module "grunt-cli" not found. Is it installed?

为了在本地安装,我运行了以下命令(由@Aruna建议)

npm install grunt --save-dev
npm install grunt-cli --save-dev

,得到第二个命令

的输出如下
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "grunt-cli" "--save-dev"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.7
npm ERR! code ENOSELF
npm ERR! Refusing to install grunt-cli as a dependency of itself
npm ERR!

我在这里错过了什么线索吗?

你是如何安装grunt的?

您是否尝试过如下的全局和本地模块,

全球

npm install -g grunt-cli 
当地

npm install grunt --save-dev
npm install grunt-cli --save-dev

最新更新