我正在尝试为 Web 构建设置 grunt。当我运行 npm install -g grunt-cli
时,出现以下错误:
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/grunt-cli/bin/grunt' -> '/usr/local/bin/grunt'
但是如果我尝试进行粗鲁的谈话,我会收到此错误:
-bash: grunt: command not found
我尝试用 npm uninstall -g grunt-cli
卸载 grunt,但它什么也没做。我在这里不知所措。如何删除那个版本的 grunt(不知何故不存在)并全局重新安装?
答案 0 :(得分:1)
在运行 grunt-cli
后尝试将 PATH
添加到您的 npm install -g 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