Npm Grunt未安装,但已存在

Npm Grunt未安装,但已存在,npm,gruntjs,Npm,Gruntjs,我正在尝试为web构建设置grunt。当我运行npm安装-g grunt cli时,我得到以下错误: npm错误!EEXIST:文件已存在,符号链接“../lib/node_modules/grunt cli/bin/grunt”->”/usr/local/bin/grunt” 但如果我尝试进行咕哝谈话,我会得到以下错误: -bash: grunt: command not found 我曾尝试使用npm uninstall-g grunt cli卸载grunt,但它没有任何作用。我在这里不

我正在尝试为web构建设置grunt。当我运行
npm安装-g grunt cli时,我得到以下错误:

npm错误!EEXIST:文件已存在,符号链接“../lib/node_modules/grunt cli/bin/grunt”->”/usr/local/bin/grunt”
但如果我尝试进行咕哝谈话,我会得到以下错误:

-bash: grunt: command not found

我曾尝试使用
npm uninstall-g grunt cli卸载grunt,但它没有任何作用。我在这里不知所措。如何删除该版本的grunt(不知何故并不存在)并全局重新安装?

运行
npm安装-g grunt cli
后,尝试将
grunt cli
添加到
路径中:

touch ~/.bash_profile
nano .bash_profile
最后加上这一行:

export PATH=/usr/local/share/npm/lib/node_modules/grunt-cli/bin:$PATH
并运行:

source ~/.bash_profile
grunt --version

您是否也在项目中本地安装了grunt?