解決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