解决mac安装grunt时出现[command not found]的错误


第一步:

  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    


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM