Bower: “command not found” after installation

前端 未结 11 1837
青春惊慌失措
青春惊慌失措 2020-11-29 02:05

I seem to be getting the following when I execute npm install bower -g

/usr/local/share/npm/bin/bower -> /usr/local/share/npm/lib/node_module         


        
相关标签:
11条回答
  • 2020-11-29 02:17

    In centos 6.8

    vi ~/.zshrc 
    

    add three row below

    export PATH=$HOME/bin:/usr/local/bin:$PATH
    export PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
    export PATH=/usr/local/share/npm/bin:$PATH
    

    and then

    exec /bin/zsh 
    

    or

    exec /usr/bin/zsh
    

    just work

    0 讨论(0)
  • 2020-11-29 02:17

    If all of the above doesn't work, or you don't seem to understand the answers provided to the question.

    I suggest you run the installation commands on your system command prompt and not git-bash, especially if your are on windows 8 or 7.

    0 讨论(0)
  • 2020-11-29 02:18

    i add this

    export PATH=$HOME/.node/bin:$PATH
    

    at the end (and new line) of my .bash_profile file( located in user folder). Save it. close and reopen terminal

    0 讨论(0)
  • 2020-11-29 02:22

    In Mac OS X add next row into your ~/.bash_profile

    export PATH="$HOME/.node/lib/node_modules/bower/bin:$PATH"

    And restart terminal or type:

    source ~/.bash_profile

    0 讨论(0)
  • 2020-11-29 02:24

    For users that are encountering issues with the installation in mac as shown in the official page, it seems that El Capitan is giving permission issues to install the package in that way:

    npm install bower -g

    The solution I've found to avoid the permission errors is using sudo (superuser do) to provide access for node to download the package like this:

    sudo npm install bower -g

    Hopefully this may help users having the same problem. :)

    0 讨论(0)
  • 2020-11-29 02:25

    If you used something other than Homebrew (yes, some of us actually did it weird) —like MacPorts, your $PATH could be funky. Binaries may be located in other areas: /opt/local/bin/grunt and possibly /opt/local/bin/npm

    Additionally if you use MacPorts to install npm then subsequently install bower, the binary will not be located where you'd expect. It actually ends up in your home directory under .npm/lib/node_modules/bower/bin

    Your $PATH should be adjusted in ~/.profile (Mac OS X) to add: $HOME/.npm/lib/node_modules/bower/bin

    Source your Bash profile or open a new terminal window and it should be working.

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