Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yo cannot find jhipster after yarn global add generator-jhipster

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.
like image 525
TechCrunch Avatar asked Feb 10 '17 04:02

TechCrunch


People also ask

Why can’t I generate a JHipster project in my home directory?

The configuration will be stored in a generated .yo-rc.json file, so it is strongly recommended not to generate a JHipster project in your HOME directory. If you did it, you won’t be able to generate another project in a sub directory. To solve it, delete the .yo-rc.json file. This is the same procedure as using NPM, with two differences:

How do I install JHipster on a node website?

Install Node.js from the Node.js website (please use an LTS 64-bit version, non-LTS versions are not supported) (optional) If you want to use a module or a blueprint (for instance from the JHipster Marketplace ), install Yeoman: npm install -g yo Now that JHipster is installed, your next step is to create an application Install a Java build tool.

Can I use JHipster with Git?

JHipster will try to commit your project to Git, if it is installed. The JHipster upgrade sub-generator requires to have Git installed. JHipster uses Yeoman for code generation. To find more information, tips and help, please have a look at the Yeoman “getting starting” guide before submitting a bug.

How do I log into a JHipster container?

The easiest way to log into the running container is by executing following command: If you copy-pasted the above command to run the container, notice that you have to specify jhipster as the container name: You will log in as the “jhipster” user.


2 Answers

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"

like image 113
CrazyRiver Avatar answered Oct 18 '22 20:10

CrazyRiver


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

yarn global add yo
like image 32
millsofmn Avatar answered Oct 18 '22 19:10

millsofmn