yo cannot find jhipster after yarn global add generator-jhipster
Asked Answered
O

3

10

I'm trying to generate a jHipster project using yarn - https://jhipster.github.io/installation/

I installed Node from its website and yarn with brew.

yarn version 0.19.1 node version v7.5.0 OSX Sierra 10.12.3

When I run yarn global add generator-jhipster, I could see jhispter generator being copied to /Users/{username}/.config/yarn/global/node_modules/

my-mac:~ user$ yarn global add generator-jhipster
yarn global v0.19.1
warning No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
warning undefined has no binaries
warning No license field
✨  Done in 30.68s.

As the next step, when I run yo jhipster, it cannot find jhipster. However, when I run yarn add generator-jhipster, yo can find jhipster from current folder. Not sure whats wrong with adding in global location.

my-mac:~ user$ echo $PATH
/usr/local/sbin:~/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/Cellar/node/7.5.0/bin:/Users/{user}/.config/yarn/global/node_modules/.bin

Will appreciate any help in identify whats going on or if there is any issue with latest yarn version.

my-mac:~ user$ yo jhipster
Error jhipster

You don’t seem to have a generator with the name “jhipster” installed.
Outspeak answered 10/2, 2017 at 4:1 Comment(0)
F
15

I had the same problem and the cause was my laziness. I did not took time to read the notes of Local installation with Yarn documentation:

Note: if you have problem to use these tools globally, be sure you have $HOME/.config/yarn/global/node_modules/.bin in your path.

On Mac or Linux: export PATH="$PATH:$(yarn global bin):$HOME/.config/yarn/global/node_modules/.bin"

Frigate answered 17/2, 2017 at 1:0 Comment(0)
O
3

To fix this issue I needed to install yeoman globally with yarn.

yarn global add yo
Orv answered 24/2, 2017 at 19:21 Comment(0)
T
-1

I am using Ubuntu and I faced this issue too. Then I use sudo to add yo package

sudo yarn global add yo

Hope this will helpful to you.

Tremml answered 29/8, 2018 at 8:47 Comment(1)
Can someone explain me why this is wrong? It was worked for me. and with the experience of npm, we used to use 'sudo' to installing global packages. thats why I use same with yarnTremml

© 2022 - 2024 — McMap. All rights reserved.