问题
When I try to create a jhipster application in ubuntu 13.10 with yo jhipster
the generated output files are always dumped in the wrong directory.
For example I run yo jhipster
in the directory /mnt/mercury/jhipster-test/alpha
then the files are dumped out to /mnt/mercury
. In fact if I run yo jhipster
in any subdirectory of /mnt/mercury
they are always dumped out to /mnt/mercury
.
I'm using yo version 1.1.2
from the standard ubuntu repository
Please advise how to generate files to be output in current directory.
For the benefit of anyone else facing this problem. I managed to get Yeoman working with the following
npm cache clean
sudo npm rm -g yo
npm cache clean
sudo npm install -g yo
回答1:
As discussed in the comments, this is a Yeoman problem on Ubuntu 13.10:
- We don't have this issue with Ubuntu 12.04
- There is the same issue with other generators ("yo webapp") on Ubuntu 13.10
As a workaround, I recommend you have a look at our Docker container:
https://github.com/jhipster/jhipster-docker
This will allow you to run the full JHipster stack, with Ubuntu 12.04, inside a container! Just use it to generate the app, then you can work directly on your host machine.
回答2:
My problem: Accidentally "yo generating" in the parent directory.
Solution: Delete the .yo-rc.json
file in the parent directory, then running the yo generator command in the child directory.
回答3:
On Mac OSX Maverick with Node v0.10.26, yo v1.1.2 and generator-jhipster v0.11, the yo hipster command was generating all the sources always in the same (wrong!) directory and not using my current directory. I fixed this problem doing the following:
cd <WRONG_DIR_WHERE_CODE_IS_CREATED>
rm .yo-rc.json node_modules/
npm uninstall -g karma
npm install -g karma (Note: using sudo it was not working!)
sudo npm install -g generator-jhipster
Not sure why but I've then been able to install karma and generator-jhipster again and suddenly yo hipster starting generating code again in my current directory
Could it be caused by different environment variables when launching npm with sudo?
回答4:
The file .yo-rc.json is hidden, if it is not deleted, the generator will constantly take the settings from it. You must delete .yo-rc.json.
来源:https://stackoverflow.com/questions/21244032/jhipster-application-files-generated-in-wrong-directory