Bower, Grunt & zsh: command not found:

前端 未结 6 485
忘了有多久
忘了有多久 2021-02-01 21:08

I have installed Grunt & Bower & I\'m using ZSH.

when I type bower --help or grunt anything I get zsh: command not found: bower

相关标签:
6条回答
  • 2021-02-01 21:35

    I used yarn instead of npm:

    yarn add grunt grunt-cli
    yarn grunt
    

    It worked for me. Hopefully, it will help someone else :)

    0 讨论(0)
  • 2021-02-01 21:36

    When you install grunt (bower), terminal tell you directory. For those using a ZSH shell, add this to .zshrc:

    export PATH=/usr/you/directory/npm/bin:$PATH,
    

    I find it using:

    /lib/node_modules
    export PATH=/usr/lib/node_modules/npm/bin:$PATH
    
    0 讨论(0)
  • 2021-02-01 21:37

    Add /usr/local/share/npm/bin/ to your $PATH environment

    0 讨论(0)
  • 2021-02-01 21:47

    I couldn't get the above to work. Problem was that I had just reinstalled my Mac and forgotten to re-install grunt.

    You can test that grunt is actually installed and working properly outside of zshell by going back to bash with bash -l and running grunt.

    If grunt is throwing the same error you can install grunt by running:

    sudo npm install -g grunt-cli 
    

    Run zsh to get back to zshell.

    0 讨论(0)
  • 2021-02-01 21:49

    When you installed, did you install globally?

    npm install -g bower
    

    give that a try. If not, also try adding sudo

    sudo npm install -g bower
    
    0 讨论(0)
  • 2021-02-01 22:01

    If you are using the GNOME-Terminal (default in Ubuntu Unity and Gnome) try the answer of https://askubuntu.com/questions/279180/nvm-command-not-found-issue.

    0 讨论(0)
提交回复
热议问题