第一步:

  1先确定一下.bash_profile是否存在.

  2在mac终端输入:

    test -e .bash_profile && echo "found" || echo "not found"

      

  3.bash_profile是一个环境配置的脚本, 如果显示的是not found, 则在终端运行

    touch ~/.bash_profile

    运行完之后重复2, 显示found, 则表明创建成功

第二步:

  1安装grunt-cli

    sudo npm install -g grunt-cli

    

  2在终端通过命令的形式打开第一步中的.bash_profile文件, 命令如下:

    open -a TextEdit ~/.bash_profile

  3将环境配置写入你打开的.bash_profile, 然后保存ctrl+s, 然后退出即可, 注意路径每个人有所不同, 要看自己grunt-cli的安装路径是什么, 路径填错无效

    export PATH=/usr/local/Cellar/node/6.7.0/libexec/npm/lib/node_modules/grunt-cli/bin:$PATH

    

第三步:

 1 在终端运行: source ~/.bash_profile

 2 在终端运行: grunt --version

 如果它正常工作的话, 你将看到grunt-cli 的版本号,like this

  

  

END    

posted on 2016-11-15 21:46  jaina  阅读(6015)  评论(0编辑  收藏  举报