zsh: command not found: jhipster

Viewed 5734

I couldn't run jhipster generator, got error: zsh: command not found: jhipster

My system is Ubuntu 16.04, I use zsh:

➜ yarn global add generator-jhipster
yarn global v0.24.5
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "generator-jhipster@4.5.0" with binaries:
      - jhipster
warning No license field
Done in 1.87s.
➜ jhipster
zsh: command not found: jhipster

What did I missed?

Also I have this in my .zshrc:

# npm
export PATH="$PATH:/home/romanovi/.npm-global/bin"
export NODE_PATH="$NODE_PATH:/home/romanovi/.npm-global/lib/node_modules"

# Yarn
export PATH="$PATH:`yarn global bin`"
7 Answers

I had the same problem and solved it by running yarn global bin and adding the returned value to my PATH.

Update Dec 2018

Just updating the path didn't work for me. I had to also set the yarn prefix.

  • Ubuntu 18.04.1 LTS (bionic)
  • yarn 1.12.3
  • npm v3.5.2
  • node v8.10.0
  • zsh

Steps

  1. Confirm your global bin path

    yarn global bin
    

I got: /home/username/.yarn/bin

  1. set yarn prefix:

    make sure your yarn prefix is the parent directory of your bin directory. You can confirm by running

    yarn config get prefix
    

    when I ran this, my prefix was empty, so I set it:

    yarn config set prefix ~/.yarn
    
  2. add the following to ~/.bash_profile

    export PATH="$PATH:`yarn global bin`"
    

    for zsh users, be sure to add this line to ~/.zshrc

  3. restart your shell or start a new one

    bash -l or zsh

Update September 2019

Just saw this problem on Mac OSX. I gave up on yarn for this.

Instead, I ran npm install -g generator-jhipster instead, and everything installed as expected.

❯ jhipster --version                                   

INFO! Using JHipster version installed globally
6.2.0

Try with sudo.

sudo yarn global add generator-jhipster

Related